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

Fixed potential collection modified exception

This commit is contained in:
JKorf 2023-04-14 21:02:21 +02:00
parent a02b3f88d7
commit 1d4353e6d1

View File

@ -629,7 +629,11 @@ namespace CryptoExchange.Net.Sockets
return new CallResult<bool>(true); return new CallResult<bool>(true);
} }
if (_subscriptions.Any(s => s.Authenticated)) bool anyAuthenticated = false;
lock (_subscriptionLock)
anyAuthenticated = _subscriptions.Any(s => s.Authenticated);
if (anyAuthenticated)
{ {
// If we reconnected a authenticated connection we need to re-authenticate // If we reconnected a authenticated connection we need to re-authenticate
var authResult = await ApiClient.AuthenticateSocketAsync(this).ConfigureAwait(false); var authResult = await ApiClient.AuthenticateSocketAsync(this).ConfigureAwait(false);