From a9445d60dd9f4b78129d55d75feb49e926ef1f32 Mon Sep 17 00:00:00 2001 From: RogueException Date: Mon, 7 Sep 2015 15:49:13 -0300 Subject: [PATCH] Reset blockEvent on connect. --- src/Discord.Net/DiscordClient.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs index 968af6530..a8fe58ffb 100644 --- a/src/Discord.Net/DiscordClient.cs +++ b/src/Discord.Net/DiscordClient.cs @@ -56,7 +56,7 @@ namespace Discord /// Initializes a new instance of the DiscordClient class. public DiscordClient(DiscordClientConfig config = null) { - _blockEvent = new ManualResetEventSlim(true); + _blockEvent = new ManualResetEventSlim(false); _config = config ?? new DiscordClientConfig(); _isDebugMode = _config.EnableDebug; _rand = new Random(); @@ -501,7 +501,7 @@ namespace Discord { await Disconnect(); - if (_isDebugMode) + if (_isDebugMode) RaiseOnDebugMessage(DebugMessageType.Connection, $"DataSocket is using cached token."); return await ConnectInternal(token); @@ -534,7 +534,8 @@ namespace Discord private async Task ConnectInternal(string token) { - _http.Token = token; + _blockEvent.Reset(); + _http.Token = token; string url = (await _api.GetWebSocketEndpoint()).Url; if (_isDebugMode) RaiseOnDebugMessage(DebugMessageType.Connection, $"DataSocket got endpoint.");