Fix websocket error when closing the server

Fix #634
pull/638/head
Julien Duponchelle 8 years ago
parent f0fad5289c
commit fa76b89731
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -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:
response = yield from self._ws.receive()
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

@ -165,7 +165,7 @@ class Link:
@property
def nodes(self):
return [ node['node'] for node in self._nodes ]
return [node['node'] for node in self._nodes]
@property
def capturing(self):

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

@ -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))

Loading…
Cancel
Save