Skip to content

Commit 42e4849

Browse files
authored
Handle improper 1000 closures by Discord
Signed-off-by: Quintenvw <[email protected]>
1 parent 9a6cbff commit 42e4849

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

discord/gateway.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,10 @@ def latency(self) -> float:
587587

588588
def _can_handle_close(self):
589589
code = self._close_code or self.socket.close_code
590-
return code not in (1000, 4004, 4010, 4011, 4012, 4013, 4014)
591-
590+
is_improper_close = self._close_code is None and self.socket.close_code == 1000
591+
return is_improper_close or code not in (1000, 4004, 4010, 4011, 4012, 4013, 4014)
592+
593+
592594
async def poll_event(self):
593595
"""Polls for a DISPATCH event and handles the general gateway loop.
594596

0 commit comments

Comments
 (0)