Browse Source

Ensure socket is disconnected before reconnecting

tags/1.0-rc
RogueException 9 years ago
parent
commit
97078b557a
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      src/Discord.Net/DiscordSocketClient.cs

+ 4
- 0
src/Discord.Net/DiscordSocketClient.cs View File

@@ -163,6 +163,10 @@ namespace Discord
if (LoginState != LoginState.LoggedIn)
throw new InvalidOperationException("You must log in before connecting.");

var state = ConnectionState;
if (state == ConnectionState.Connecting || state == ConnectionState.Connected)
await DisconnectInternalAsync().ConfigureAwait(false);

ConnectionState = ConnectionState.Connecting;
await _gatewayLogger.InfoAsync("Connecting");
try


Loading…
Cancel
Save