File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -175,8 +175,9 @@ async def _receive(self) -> str:
175
175
"""Wait the next message from the websocket connection and log the answer
176
176
"""
177
177
178
- # We should always have an active websocket connection here
179
- assert self .websocket is not None
178
+ # It is possible that the websocket has been already closed in another task
179
+ if self .websocket is None :
180
+ raise TransportClosed ("Transport is already closed" )
180
181
181
182
# Wait for the next websocket frame. Can raise ConnectionClosed
182
183
data : Data = await self .websocket .recv ()
@@ -387,6 +388,8 @@ async def _receive_data_loop(self) -> None:
387
388
except (ConnectionClosed , TransportProtocolError ) as e :
388
389
await self ._fail (e , clean_close = False )
389
390
break
391
+ except TransportClosed :
392
+ break
390
393
391
394
# Parse the answer
392
395
try :
You can’t perform that action at this time.
0 commit comments