1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-17 03:12:56 +00:00

Fix for Message not handled when closing subscription, fix for reconnect loop

This commit is contained in:
JKorf
2022-07-12 22:06:38 +02:00
parent 41f17d0378
commit c815fad135
3 changed files with 11 additions and 3 deletions
@@ -385,7 +385,7 @@ namespace CryptoExchange.Net.Sockets
if (!subscriptions.Contains(subscription))
return;
subscriptions.Remove(subscription);
subscription.Closed = true;
}
if (Status == SocketStatus.Closing || Status == SocketStatus.Closed || Status == SocketStatus.Disposed)
@@ -407,7 +407,7 @@ namespace CryptoExchange.Net.Sockets
return;
}
shouldCloseConnection = subscriptions.All(r => !r.UserSubscription);
shouldCloseConnection = subscriptions.All(r => !r.UserSubscription || r.Closed);
if (shouldCloseConnection)
Status = SocketStatus.Closing;
}
@@ -417,6 +417,9 @@ namespace CryptoExchange.Net.Sockets
log.Write(LogLevel.Debug, $"Socket {SocketId} closing as there are no more subscriptions");
await CloseAsync().ConfigureAwait(false);
}
lock (subscriptionLock)
subscriptions.Remove(subscription);
}
/// <summary>