Browse Source

Merge branch 'dev' of https://github.com/RogueException/Discord.Net into dev

tags/1.0-rc
Christopher F 8 years ago
parent
commit
c8be07c652
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/Discord.Net/DiscordSocketClient.cs

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

@@ -269,13 +269,14 @@ namespace Discord
{ {
try try
{ {
Random jitter = new Random();
int nextReconnectDelay = 1000; int nextReconnectDelay = 1000;
while (true) while (true)
{ {
await Task.Delay(nextReconnectDelay, cancelToken).ConfigureAwait(false); await Task.Delay(nextReconnectDelay, cancelToken).ConfigureAwait(false);
nextReconnectDelay *= 2;
if (nextReconnectDelay > 30000)
nextReconnectDelay = 30000;
nextReconnectDelay = nextReconnectDelay * 2 + jitter.Next(-250, 250);
if (nextReconnectDelay > 60000)
nextReconnectDelay = 60000;


await _connectionLock.WaitAsync().ConfigureAwait(false); await _connectionLock.WaitAsync().ConfigureAwait(false);
try try


Loading…
Cancel
Save