mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-15 02:13:01 +00:00
Added custom async wait event implementation as the previously used method seemed to not work 100% of the time
This commit is contained in:
@@ -29,7 +29,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
private Task? _sendTask;
|
||||
private Task? _receiveTask;
|
||||
private Task? _timeoutTask;
|
||||
private readonly AutoResetEvent _sendEvent;
|
||||
private readonly AsyncResetEvent _sendEvent;
|
||||
private readonly ConcurrentQueue<byte[]> _sendBuffer;
|
||||
private readonly IDictionary<string, string> cookies;
|
||||
private readonly IDictionary<string, string> headers;
|
||||
@@ -216,7 +216,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
|
||||
_outgoingMessages = new List<DateTime>();
|
||||
_receivedMessages = new Dictionary<DateTime, int>();
|
||||
_sendEvent = new AutoResetEvent(false);
|
||||
_sendEvent = new AsyncResetEvent();
|
||||
_sendBuffer = new ConcurrentQueue<byte[]>();
|
||||
_ctsSource = new CancellationTokenSource();
|
||||
_receivedMessagesLock = new object();
|
||||
@@ -385,7 +385,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
if (_closing)
|
||||
break;
|
||||
|
||||
await _sendEvent.WaitOneAsync().ConfigureAwait(false);
|
||||
await _sendEvent.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
if (_closing)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user