Browse Source

Handle connection errors during reidentify flow.

pull/5164/head
Rapptz 5 years ago
parent
commit
80cc5b5edb
  1. 6
      discord/shard.py

6
discord/shard.py

@ -135,11 +135,15 @@ class Shard:
async def reidentify(self, exc): async def reidentify(self, exc):
self._cancel_task() self._cancel_task()
self._dispatch('disconnect')
log.info('Got a request to %s the websocket at Shard ID %s.', exc.op, self.id) log.info('Got a request to %s the websocket at Shard ID %s.', exc.op, self.id)
try:
coro = DiscordWebSocket.from_client(self._client, resume=exc.resume, shard_id=self.id, coro = DiscordWebSocket.from_client(self._client, resume=exc.resume, shard_id=self.id,
session=self.ws.session_id, sequence=self.ws.sequence) session=self.ws.session_id, sequence=self.ws.sequence)
self._dispatch('disconnect')
self.ws = await asyncio.wait_for(coro, timeout=180.0) self.ws = await asyncio.wait_for(coro, timeout=180.0)
except self._handled_exceptions as e:
await self._handle_disconnect(e)
else:
self.launch() self.launch()
async def reconnect(self): async def reconnect(self):

Loading…
Cancel
Save