mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 15:06:07 +00:00
Handle improper 1000 closures by Discord
This commit is contained in:
parent
a0b0a97e52
commit
ed615887f0
@ -606,7 +606,10 @@ class DiscordWebSocket:
|
||||
|
||||
def _can_handle_close(self) -> bool:
|
||||
code = self._close_code or self.socket.close_code
|
||||
return code not in (1000, 4004, 4010, 4011, 4012, 4013, 4014)
|
||||
# If the socket is closed remotely with 1000 and it's not our own explicit close
|
||||
# then it's an improper close that should be handled and reconnected
|
||||
is_improper_close = self._close_code is None and self.socket.close_code == 1000
|
||||
return is_improper_close or code not in (1000, 4004, 4010, 4011, 4012, 4013, 4014)
|
||||
|
||||
async def poll_event(self) -> None:
|
||||
"""Polls for a DISPATCH event and handles the general gateway loop.
|
||||
|
Loading…
x
Reference in New Issue
Block a user