Fix gateway deadlock (#2600)

Co-authored-by: Quin Lynch <lynchquin@gmail.com>
This commit is contained in:
Casmir
2023-02-14 22:44:54 +01:00
committed by GitHub
parent 50e0e5941a
commit 0c27395efd

View File

@@ -78,14 +78,15 @@ namespace Discord
nextReconnectDelay = 1000; //Reset delay nextReconnectDelay = 1000; //Reset delay
await _connectionPromise.Task.ConfigureAwait(false); await _connectionPromise.Task.ConfigureAwait(false);
} }
catch (OperationCanceledException ex) // remove for testing.
{ //catch (OperationCanceledException ex)
// Added back for log out / stop to client. The connection promise would cancel and it would be logged as an error, shouldn't be the case. //{
// ref #2026 // // Added back for log out / stop to client. The connection promise would cancel and it would be logged as an error, shouldn't be the case.
// // ref #2026
Cancel(); //In case this exception didn't come from another Error call // Cancel(); //In case this exception didn't come from another Error call
await DisconnectAsync(ex, !reconnectCancelToken.IsCancellationRequested).ConfigureAwait(false); // await DisconnectAsync(ex, !reconnectCancelToken.IsCancellationRequested).ConfigureAwait(false);
} //}
catch (Exception ex) catch (Exception ex)
{ {
Error(ex); //In case this exception didn't come from another Error call Error(ex); //In case this exception didn't come from another Error call