1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-07-23 18:05:43 +00:00

Fixed unhandled messages after unsubscribing

This commit is contained in:
Jan Korf 2021-04-27 15:34:33 +02:00
parent 2720a03290
commit 93a64b2b1d

View File

@ -424,14 +424,13 @@ namespace CryptoExchange.Net.Sockets
var shouldCloseWrapper = false;
lock (handlersLock)
{
handlers.Remove(subscription);
if (handlers.Count(r => r.UserSubscription) == 0)
shouldCloseWrapper = true;
}
shouldCloseWrapper = handlers.Count(r => r.UserSubscription && subscription != r) == 0;
if (shouldCloseWrapper)
await Close().ConfigureAwait(false);
lock (handlersLock)
handlers.Remove(subscription);
}
}