1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-30 20:28:08 +00:00

Fix websocket error when closing the server

Fix #634
This commit is contained in:
Julien Duponchelle 2016-08-19 11:20:56 +02:00
parent f0fad5289c
commit fa76b89731
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
4 changed files with 7 additions and 5 deletions

View File

@ -299,6 +299,7 @@ class Compute:
# https://www.python.org/dev/peps/pep-0492/
# that why we wrap the answer
class StreamResponse:
def __init__(self, response):
self._response = response
@ -350,7 +351,11 @@ class Compute:
"""
self._ws = yield from self._session().ws_connect(self._getUrl("/notifications/ws"))
while True:
try:
response = yield from self._ws.receive()
except aiohttp.errors.WSServerHandshakeError:
self._ws = None
return
if response.tp == aiohttp.MsgType.closed or response.tp == aiohttp.MsgType.error:
self._connected = False
break

View File

@ -127,4 +127,3 @@ def wait_for_named_pipe_creation(pipe_path, timeout=60):
else:
return
raise asyncio.TimeoutError()

View File

@ -67,5 +67,3 @@ def test_wait_for_process_termination(loop):
exec = wait_for_process_termination(process, timeout=0.5)
with pytest.raises(asyncio.TimeoutError):
loop.run_until_complete(asyncio.async(exec))