mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-24 18:23:50 +02:00
Ignore OSError when closing websocket
This commit is contained in:
parent
af9860f965
commit
01a9e83f08
@ -78,8 +78,10 @@ async def notification_ws(websocket: WebSocket) -> None:
|
|||||||
except WebSocketException as e:
|
except WebSocketException as e:
|
||||||
log.warning(f"Error while sending to controller event to WebSocket client: {e}")
|
log.warning(f"Error while sending to controller event to WebSocket client: {e}")
|
||||||
finally:
|
finally:
|
||||||
await websocket.close()
|
try:
|
||||||
|
await websocket.close()
|
||||||
|
except OSError:
|
||||||
|
pass # ignore OSError: [Errno 107] Transport endpoint is not connected
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
@ -72,4 +72,7 @@ async def controller_ws_notifications(
|
|||||||
except WebSocketException as e:
|
except WebSocketException as e:
|
||||||
log.warning(f"Error while sending to controller event to WebSocket client: {e}")
|
log.warning(f"Error while sending to controller event to WebSocket client: {e}")
|
||||||
finally:
|
finally:
|
||||||
await websocket.close()
|
try:
|
||||||
|
await websocket.close()
|
||||||
|
except OSError:
|
||||||
|
pass # ignore OSError: [Errno 107] Transport endpoint is not connected
|
||||||
|
@ -271,7 +271,10 @@ async def project_ws_notifications(
|
|||||||
except WebSocketException as e:
|
except WebSocketException as e:
|
||||||
log.warning(f"Error while sending to project event to WebSocket client: {e}")
|
log.warning(f"Error while sending to project event to WebSocket client: {e}")
|
||||||
finally:
|
finally:
|
||||||
await websocket.close()
|
try:
|
||||||
|
await websocket.close()
|
||||||
|
except OSError:
|
||||||
|
pass # ignore OSError: [Errno 107] Transport endpoint is not connected
|
||||||
if project.auto_close:
|
if project.auto_close:
|
||||||
# To avoid trouble with client connecting disconnecting we sleep few seconds before checking
|
# To avoid trouble with client connecting disconnecting we sleep few seconds before checking
|
||||||
# if someone else is not connected
|
# if someone else is not connected
|
||||||
|
Loading…
Reference in New Issue
Block a user