-
Notifications
You must be signed in to change notification settings - Fork 812
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 the problem of reconnecting when moved to another VC #1271
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, however I'm not fully sure about this for
based retry solution
P.S. Thanks for fixing such longstanding issue!
Co-authored-by: Fedor Lapshin <[email protected]>
Co-authored-by: Fedor Lapshin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for a long wait.
Co-authored-by: Fedor Lapshin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
P.S. About the To Do comment. I've marked this loop, since we will probably replace it with a proper solution, using our event system, sometime in the future, alongisde other unrefactored stuff.
Anyhow, thank you for your work and patience. |
Fixes #849.
Description
When the bot was moved to another vc, the connection was disconnected with
4014 Disconnected
.Then,
VOICE_SERVER_UPDATE
is received after4014 Disconnected
.However, the VoiceConnection has been deleted when the
VOICE_SERVER_UPDATE
is received due to the following code. (L364)discordgo/voice.go
Lines 355 to 370 in afab840
Since the VoiceConnection does not exist,
onVoiceServerUpdate
does not reconnect.discordgo/wsapi.go
Lines 761 to 772 in afab840
This is the cause of #849.
How to fix
Delay the time between receiving
4014 Disconnected
and deleting the connection.If
VOICE_SERVER_UPDATE
is received during that time, the connection is not deleted.If not (e.g. kicked by admin), the connection is deleted.