Don't try to remove websocket from log listeners if it had not been added

This commit is contained in:
Tulir Asokan 2018-11-29 12:28:23 +02:00
parent 2b8a5353be
commit 30a6dd62ef

View file

@ -133,6 +133,7 @@ async def log_websocket(request: web.Request) -> web.WebSocketResponse:
await ws.close() await ws.close()
except Exception: except Exception:
pass pass
if authenticated:
handler.listeners.remove(ws) handler.listeners.remove(ws)
log.debug(f"Connection from {request.remote} closed") log.debug(f"Connection from {request.remote} closed")
sockets.remove(ws) sockets.remove(ws)