mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-08 00:16:27 +00:00
Add checks for Disposed
This commit is contained in:
parent
c7069a4049
commit
a9813ecb0a
@ -261,8 +261,10 @@ namespace CryptoExchange.Net.OrderBook
|
|||||||
_subscription.ConnectionLost += () =>
|
_subscription.ConnectionLost += () =>
|
||||||
{
|
{
|
||||||
log.Write(LogLevel.Warning, $"{Id} order book {Symbol} connection lost");
|
log.Write(LogLevel.Warning, $"{Id} order book {Symbol} connection lost");
|
||||||
|
if (Status != OrderBookStatus.Disposed) {
|
||||||
Status = OrderBookStatus.Reconnecting;
|
Status = OrderBookStatus.Reconnecting;
|
||||||
Reset();
|
Reset();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
_subscription.ConnectionClosed += () =>
|
_subscription.ConnectionClosed += () =>
|
||||||
{
|
{
|
||||||
@ -601,13 +603,13 @@ namespace CryptoExchange.Net.OrderBook
|
|||||||
|
|
||||||
private async Task ProcessQueue()
|
private async Task ProcessQueue()
|
||||||
{
|
{
|
||||||
while (Status != OrderBookStatus.Disconnected)
|
while (Status != OrderBookStatus.Disconnected && Status != OrderBookStatus.Disposed)
|
||||||
{
|
{
|
||||||
await _queueEvent.WaitAsync().ConfigureAwait(false);
|
await _queueEvent.WaitAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
while (_processQueue.TryDequeue(out var item))
|
while (_processQueue.TryDequeue(out var item))
|
||||||
{
|
{
|
||||||
if (Status == OrderBookStatus.Disconnected)
|
if (Status == OrderBookStatus.Disconnected || Status == OrderBookStatus.Disposed)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (_stopProcessing)
|
if (_stopProcessing)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user