Do not allow ObjectDisposed exceptions to trigger disconnectreason

This commit is contained in:
Brandon Smith
2015-09-04 19:32:26 -03:00
parent 8f7492c246
commit f6dacb7a84

View File

@@ -146,11 +146,11 @@ namespace Discord
if (_webSocket.State != WebSocketState.Open || cancelToken.IsCancellationRequested)
return;
try
try
{
result = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), cancelToken);
}
catch (Win32Exception ex)
catch (Win32Exception ex)
when (ex.HResult == HR_TIMEOUT)
{
string msg = $"Connection timed out.";
@@ -182,6 +182,7 @@ namespace Discord
}
}
catch (OperationCanceledException) { }
catch (ObjectDisposedException) { }
catch (Exception ex) { DisconnectInternal(ex); }
}
private async Task SendAsync()
@@ -210,6 +211,7 @@ namespace Discord
}
}
catch (OperationCanceledException) { }
catch (ObjectDisposedException) { }
catch (Exception ex) { DisconnectInternal(ex); }
}