From 889e1a83315563b1d3cb916c8600596d37dfe29a Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 8 Jul 2021 09:19:44 -0400 Subject: [PATCH] Don't kill the gateway session when trying to resume Sending a close code of 1000 or 1001 invalidates gateway sessions. Instead, we use close code 1005 (no error specified) --- Myriad/Gateway/State/ShardStateManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Myriad/Gateway/State/ShardStateManager.cs b/Myriad/Gateway/State/ShardStateManager.cs index 1cd0229c..2345a0d4 100644 --- a/Myriad/Gateway/State/ShardStateManager.cs +++ b/Myriad/Gateway/State/ShardStateManager.cs @@ -163,7 +163,9 @@ namespace Myriad.Gateway private async Task HandleReconnect() { _logger.Information("Shard {ShardId}: Received Reconnect", _info.ShardId); - await DoReconnect(WebSocketCloseStatus.NormalClosure, TimeSpan.FromSeconds(1)); + // close code 1000 kills the session, so can't reconnect + // we use 1005 (no error specified) instead + await DoReconnect(WebSocketCloseStatus.Empty, TimeSpan.FromSeconds(1)); } private Task HandleReady(ReadyEvent ready)