-
-
Notifications
You must be signed in to change notification settings - Fork 736
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
[Feature] Voice reconnection and resuming #2873
Conversation
…sconnected event when is going to reconnect
builds failed 💀 ?????? |
The old pipeline runs on .NET 6 and thus doesn't support .net7+ features |
How can I find out where the problem is? |
@Misha-133 resolved |
@Lepterion I have a couple of questions tho.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Discord.ConnectionManager.<>c__DisplayClass29_0.<<StartAsync>b__0>d.MoveNext() in H:\github\Discord.Net\src\Discord.Net.WebSocket\ConnectionManager.cs:line 79 and System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Discord.WebSocket.SocketGuild.ConnectAudioAsync(UInt64 channelId, Boolean selfDeaf, Boolean selfMute, Boolean external, Boolean disconnect) in H:\github\Discord.Net\src\Discord.Net.WebSocket\Entities\Guilds\SocketGuild.cs:line 1802
at Discord.WebSocket.SocketGuild.ConnectAudioAsync(UInt64 channelId, Boolean selfDeaf, Boolean selfMute, Boolean external, Boolean disconnect) in H:\github\Discord.Net\src\Discord.Net.WebSocket\Entities\Guilds\SocketGuild.cs:line 1807 repro steps:
|
|
@Misha-133 task csncelled exception can be neverminded |
Yeah, but we could keep the stream alive on our end
would be a breaking change. |
Is this very bad? |
We can't make breaking changes on non-major version bumps |
@Misha-133 I can create |
That would still be a breaking change |
The reason for changing event's behaviour is that every time |
@Misha-133 commited with this thing implemented |
@Misha-133 so what do you think? |
Yeah sorry for the delay, I'll take a look at it later |
Could you merge |
Dnet's dev into this? |
@Misha-133 done |
Description
This PR adds missing reconnection and resume features to the AudioClient.
VOICE_STATE_UPDATE
message saying the bot changed it's channel, following byVOICE_SERVER_UPDATE
messages are received)4001
,4002
,4003
,4004
,4005
,4006
,4009
,4012
,4016
, the client'll try to resume lost connection. If it can't, the connection's stopped and the consumer needs to reconnect the client manually.Changes
AudioClient:
BlacklistedResumeCodes
StopReason
_stopReason
and_resuming
for disconnection controlConnectionManager.Disconnected
toAudioClient.Disconnected
. This is done manuallyStopAsync()
now calls internal overloadStopAsync(StopReason)
withStopReason.Normal
OnConnectingAsync()
depending on the_resuming
value send either Identity or Resume messageOnDisconnectingAsync(Exception)
methodFinishDisconnect
andClearHeartBeaters
in order to make disconnect handling look better_keepaliveTimes
WaitForDisconnectAsync(TimeSpan)
OpCode 9 Resumed
websocket messageConnectionManager
175
and176
. This shouldn't affect anything but makes handling disconnection easier.DiscordVoiceApiClient
SendResume
SocketGuild
AddOrUpdateVoiceStateAsync
stop the audio connection if moved or disconnectedFinishConnectAudio
if the connection is still active, wait until it closes (Doesn't block the gateway unless something's terribly wrong)Other
Related Issues
idk, this might be mentioned somewhere, but I couldn't find any related issues on GitHub.