Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle improper 1000 closures by discord #2632

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Handle improper 1000 closures by Discord
Signed-off-by: Quintenvw <contact@quintenvw.com>
  • Loading branch information
Quintenvw authored Oct 29, 2024
commit 42e4849f30227b41d342148bb900316d84b173c2
6 changes: 4 additions & 2 deletions discord/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,10 @@ def latency(self) -> float:

def _can_handle_close(self):
code = self._close_code or self.socket.close_code
return code not in (1000, 4004, 4010, 4011, 4012, 4013, 4014)

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):
"""Polls for a DISPATCH event and handles the general gateway loop.

Expand Down
Loading