I hate everything

This commit is contained in:
Marks Polakovs 2020-04-15 17:13:35 +02:00
parent 9a23746c0c
commit 6e3aab988d

View file

@ -152,7 +152,7 @@ class Session(object):
if self.websocket is not None: if self.websocket is not None:
try: try:
await self.websocket.send(json.dumps({"kind": "DEACTIVATED"})) await self.websocket.send(json.dumps({"kind": "DEACTIVATED"}))
except websockets.exceptions.ConnectionClosedError: except websockets.exceptions.ConnectionClosed:
print(self.connection_id, "not sending DEACTIVATED as it's already closed") print(self.connection_id, "not sending DEACTIVATED as it's already closed")
pass pass
@ -178,7 +178,7 @@ class Session(object):
try: try:
await self.websocket.send(json.dumps({"kind": "DIED"})) await self.websocket.send(json.dumps({"kind": "DIED"}))
await self.websocket.close(1008) await self.websocket.close(1008)
except websockets.exceptions.ConnectionClosedError: except websockets.exceptions.ConnectionClosed:
print(self.connection_id, "socket already closed, no died message") print(self.connection_id, "socket already closed, no died message")
if self.connection_id in active_sessions: if self.connection_id in active_sessions:
@ -326,7 +326,7 @@ class Session(object):
json.dumps({"kind": "ERROR", "error": "unknown_kind"}) json.dumps({"kind": "ERROR", "error": "unknown_kind"})
) )
except websockets.exceptions.ConnectionClosedError: except websockets.exceptions.ConnectionClosed:
print(self.connection_id, "WebSocket closed") print(self.connection_id, "WebSocket closed")
await self.end() await self.end()