Browse Source

Add lock to InvalidSession

pull/1537/head
Paulo 4 years ago
parent
commit
0cca17f1a2
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

+ 9
- 1
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -520,7 +520,15 @@ namespace Discord.WebSocket
_sessionId = null; _sessionId = null;
_lastSeq = 0; _lastSeq = 0;


await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, guildSubscriptions: _guildSubscriptions, gatewayIntents: _gatewayIntents).ConfigureAwait(false);
await _shardedClient.AcquireIdentifyLockAsync(ShardId, _connection.CancelToken).ConfigureAwait(false);
try
{
await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, guildSubscriptions: _guildSubscriptions, gatewayIntents: _gatewayIntents).ConfigureAwait(false);
}
finally
{
_shardedClient.ReleaseIdentifyLock();
}
} }
break; break;
case GatewayOpCode.Reconnect: case GatewayOpCode.Reconnect:


Loading…
Cancel
Save