1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-12-17 20:32:25 +00:00

Update HighPerfWebSocketClient.cs

This commit is contained in:
Jkorf 2025-12-15 08:49:25 +01:00
parent 8720130990
commit 0b1cf9086c

View File

@ -145,7 +145,9 @@ namespace CryptoExchange.Net.Sockets.HighPerf
catch (Exception e)
{
if (ct.IsCancellationRequested)
{
_logger.SocketConnectingCanceled(Id);
}
else if (!_ctsSource.IsCancellationRequested)
{
// if _ctsSource was canceled this was already logged
@ -271,10 +273,12 @@ namespace CryptoExchange.Net.Sockets.HighPerf
try
{
if (_socket!.State == WebSocketState.CloseReceived)
await _socket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Closing", default).ConfigureAwait(false);
else if (_socket.State == WebSocketState.Open)
{
await _socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closing", default).ConfigureAwait(false);
}
else if (_socket.State == WebSocketState.Open)
{
await _socket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Closing", default).ConfigureAwait(false);
var startWait = DateTime.UtcNow;
while (_processing && _socket.State != WebSocketState.Closed && _socket.State != WebSocketState.Aborted)