mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-12 02:16:23 +00:00
Small fix when closing socket
This commit is contained in:
parent
1c8cf5ac98
commit
5683ae0b3c
@ -280,8 +280,14 @@ namespace CryptoExchange.Net.Sockets
|
|||||||
_sendEvent.Set();
|
_sendEvent.Set();
|
||||||
|
|
||||||
if (_socket.State == WebSocketState.Open)
|
if (_socket.State == WebSocketState.Open)
|
||||||
await _socket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Closing", default).ConfigureAwait(false);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _socket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Closing", default).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch(Exception)
|
||||||
|
{ } // Can sometimes throw an exception when socket is in aborted state due to timing
|
||||||
|
}
|
||||||
log.Write(LogLevel.Debug, $"Socket {Id} closed");
|
log.Write(LogLevel.Debug, $"Socket {Id} closed");
|
||||||
Handle(closeHandlers);
|
Handle(closeHandlers);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user