Browse Source

Reset blockEvent on connect.

tags/docs-0.9
RogueException 9 years ago
parent
commit
a9445d60dd
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/Discord.Net/DiscordClient.cs

+ 4
- 3
src/Discord.Net/DiscordClient.cs View File

@@ -56,7 +56,7 @@ namespace Discord
/// <summary> Initializes a new instance of the DiscordClient class. </summary> /// <summary> Initializes a new instance of the DiscordClient class. </summary>
public DiscordClient(DiscordClientConfig config = null) public DiscordClient(DiscordClientConfig config = null)
{ {
_blockEvent = new ManualResetEventSlim(true);
_blockEvent = new ManualResetEventSlim(false);
_config = config ?? new DiscordClientConfig(); _config = config ?? new DiscordClientConfig();
_isDebugMode = _config.EnableDebug; _isDebugMode = _config.EnableDebug;
_rand = new Random(); _rand = new Random();
@@ -501,7 +501,7 @@ namespace Discord
{ {
await Disconnect(); await Disconnect();


if (_isDebugMode)
if (_isDebugMode)
RaiseOnDebugMessage(DebugMessageType.Connection, $"DataSocket is using cached token."); RaiseOnDebugMessage(DebugMessageType.Connection, $"DataSocket is using cached token.");


return await ConnectInternal(token); return await ConnectInternal(token);
@@ -534,7 +534,8 @@ namespace Discord


private async Task<string> ConnectInternal(string token) private async Task<string> ConnectInternal(string token)
{ {
_http.Token = token;
_blockEvent.Reset();
_http.Token = token;
string url = (await _api.GetWebSocketEndpoint()).Url; string url = (await _api.GetWebSocketEndpoint()).Url;
if (_isDebugMode) if (_isDebugMode)
RaiseOnDebugMessage(DebugMessageType.Connection, $"DataSocket got endpoint."); RaiseOnDebugMessage(DebugMessageType.Connection, $"DataSocket got endpoint.");


Loading…
Cancel
Save