[Fix] Disconnecting socket client does not send close code (#2714)
* fix? * whoops, debugging stuff
This commit is contained in:
@@ -110,9 +110,6 @@ namespace Discord.Net.WebSockets
|
||||
{
|
||||
_isDisconnecting = true;
|
||||
|
||||
try
|
||||
{ _disconnectTokenSource.Cancel(false); }
|
||||
catch { }
|
||||
|
||||
if (_client != null)
|
||||
{
|
||||
@@ -120,11 +117,22 @@ namespace Discord.Net.WebSockets
|
||||
{
|
||||
var status = (WebSocketCloseStatus)closeCode;
|
||||
try
|
||||
{ await _client.CloseOutputAsync(status, "", new CancellationToken()); }
|
||||
{
|
||||
await _client.CloseOutputAsync(status, "", new CancellationToken());
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
try
|
||||
{ _client.Dispose(); }
|
||||
{
|
||||
_client.Dispose();
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
_disconnectTokenSource.Cancel(false);
|
||||
}
|
||||
catch { }
|
||||
|
||||
_client = null;
|
||||
|
||||
Reference in New Issue
Block a user