diff --git a/CryptoExchange.Net/CryptoExchange.Net.xml b/CryptoExchange.Net/CryptoExchange.Net.xml
index f9a1a0f..de29b82 100644
--- a/CryptoExchange.Net/CryptoExchange.Net.xml
+++ b/CryptoExchange.Net/CryptoExchange.Net.xml
@@ -3818,7 +3818,9 @@
-
+
+
+System.Diagnostics.CodeAnalysis.AllowNullAttribute">
Specifies that is allowed as an input even if the
corresponding type disallows it.
diff --git a/CryptoExchange.Net/OrderBook/SymbolOrderBook.cs b/CryptoExchange.Net/OrderBook/SymbolOrderBook.cs
index 88ebc05..0d530bc 100644
--- a/CryptoExchange.Net/OrderBook/SymbolOrderBook.cs
+++ b/CryptoExchange.Net/OrderBook/SymbolOrderBook.cs
@@ -463,6 +463,9 @@ namespace CryptoExchange.Net.OrderBook
if(!checksumResult)
{
+ // Reconnects the socket, also closing other subscriptions on that socket.
+ // Should maybe only reconnect the specific subscription?
+
log.Write(LogLevel.Warning, $"{Id} order book {Symbol} out of sync. Resyncing");
_ = subscription?.ReconnectAsync();
return;
diff --git a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs
index fccd4d6..c16fa54 100644
--- a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs
+++ b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs
@@ -336,29 +336,33 @@ namespace CryptoExchange.Net.Sockets
_startedSent = true;
while (true)
{
+ if (_closing)
+ break;
+
_sendEvent.WaitOne();
if (_closing)
- break;
-
- if (!_sendBuffer.TryDequeue(out var data))
- continue;
-
- try
- {
- await _socket.SendAsync(new ArraySegment(data, 0, data.Length), WebSocketMessageType.Text, true, _ctsSource.Token).ConfigureAwait(false);
- }
- catch (OperationCanceledException)
- {
- // cancelled
break;
- }
- catch (WebSocketException wse)
+
+ while (_sendBuffer.TryDequeue(out var data))
{
- // Connection closed unexpectedly
- Handle(errorHandlers, wse);
- await CloseInternalAsync(false, true).ConfigureAwait(false);
- break;
+ try
+ {
+ log.Write(LogLevel.Debug, "Sending " + Encoding.UTF8.GetString(data));
+ await _socket.SendAsync(new ArraySegment(data, 0, data.Length), WebSocketMessageType.Text, true, _ctsSource.Token).ConfigureAwait(false);
+ }
+ catch (OperationCanceledException)
+ {
+ // cancelled
+ break;
+ }
+ catch (WebSocketException wse)
+ {
+ // Connection closed unexpectedly
+ Handle(errorHandlers, wse);
+ await CloseInternalAsync(false, true).ConfigureAwait(false);
+ break;
+ }
}
}
}