-
-
Notifications
You must be signed in to change notification settings - Fork 741
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
Reconnect() after InvalidSession might be not working #938
Comments
Use this while we wait for an update: |
@Bitl I know about that and I'm already doing something similar. I'm trying to find what causes it and |
This looks like the problem from my findings as well. I have a patch running on my testing bots right now to test, just waiting on the next Discord outage to be sure. |
This resolves discord-net#938 and discord-net#883 Note: This fix is not 'verified' in production (I waited over a week for another full Discord outage and never encountered one), but I do have it on record from b1nzy that Discord may send an OP9 with `{"d": true}` during outages, so this would appear to be the proper fix. The removed code seems to have been leftover from when ConnectionManager was rewritten and never finished.
After the recent discord issue, all my Discord.Net bots didn't reconnect. some screenshots:
The common between them was the "Failed to resume previous session" before disconnecting and staying like that.
Looking through the source, I saw
_connection.Reconnect(); //TODO: Untested
https://github.com/RogueException/Discord.Net/blob/a384ce02abcca096cb99d55f7ba9b52c2ec48148/src/Discord.Net.WebSocket/DiscordSocketClient.cs#L421
So I thought about trying to simulate Discord sending an InvalidSession opcode with the following code:
What I did was changing the "payload" (the bool inside the Invoke). These are the results:
With
false
(sends an Identify):It reconnects succesfully.
With
true
(calls Reconnect()):It justs disconnects and stays like that.
I don't really know much about how the ConnectionManager works, but I'm assuming
Reconnect()
isn't doing it's job and leaves it in that idle disconnected state and causing what happens at #883The text was updated successfully, but these errors were encountered: