Handle connection closed when sending RECONNECT

This commit is contained in:
Luna 2020-04-05 01:27:29 -03:00
parent 24ff453c6b
commit 1cbc4541a8
1 changed files with 7 additions and 7 deletions

View File

@ -190,6 +190,7 @@ class StateManager:
"""Send OP Reconnect to a single connection.""" """Send OP Reconnect to a single connection."""
websocket = state.ws websocket = state.ws
try:
await websocket.send({"op": OP.RECONNECT}) await websocket.send({"op": OP.RECONNECT})
# wait 200ms # wait 200ms
@ -197,7 +198,6 @@ class StateManager:
# our payload then close the connection # our payload then close the connection
await asyncio.sleep(0.2) await asyncio.sleep(0.2)
try:
# try to close the connection ourselves # try to close the connection ourselves
await websocket.ws.close(code=4000, reason="litecord shutting down") await websocket.ws.close(code=4000, reason="litecord shutting down")
except ConnectionClosed: except ConnectionClosed: