Kill any lingering spawning test server on Android when handling /start

BUG=665686

Review-Url: https://codereview.chromium.org/2508873003
Cr-Original-Commit-Position: refs/heads/master@{#432788}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 75b27526ecaf8fe51b180639e2c9a46b87613dd9
This commit is contained in:
eroman 2016-11-16 22:48:04 -08:00 коммит произвёл Commit bot
Родитель 1f27ec197f
Коммит 7931e19b94
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -321,7 +321,14 @@ class SpawningServerRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
logging.info(content_length)
test_server_argument_json = self.rfile.read(content_length)
logging.info(test_server_argument_json)
assert not self.server.test_server_instance
# There should only be one test server instance at a time. However it may
# be possible that a previous instance was not cleaned up properly
# (crbug.com/665686)
if self.server.test_server_instance:
port = self.server.test_server_instance.host_port
logging.info('Killing lingering test server instance on port: %d', port)
self.server.test_server_instance.Stop()
self.server.test_server_instance = None
ready_event = threading.Event()
self.server.test_server_instance = TestServerThread(
ready_event,