diff --git a/ArchiSteamFarm/ASF.cs b/ArchiSteamFarm/ASF.cs index a8bd7b4a5..efd09a7a7 100644 --- a/ArchiSteamFarm/ASF.cs +++ b/ArchiSteamFarm/ASF.cs @@ -62,6 +62,7 @@ namespace ArchiSteamFarm { internal static ICrossProcessSemaphore GiftsSemaphore { get; private set; } internal static ICrossProcessSemaphore InventorySemaphore { get; private set; } internal static ICrossProcessSemaphore LoginRateLimitingSemaphore { get; private set; } + internal static ICrossProcessSemaphore LoginSemaphore { get; private set; } internal static ImmutableDictionary WebLimitingSemaphores { get; private set; } private static readonly SemaphoreSlim UpdateSemaphore = new SemaphoreSlim(1, 1); @@ -147,6 +148,7 @@ namespace ArchiSteamFarm { GiftsSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(GiftsSemaphore) + webProxyText); InventorySemaphore ??= OS.CreateCrossProcessSemaphore(nameof(InventorySemaphore) + webProxyText); LoginRateLimitingSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(LoginRateLimitingSemaphore) + webProxyText); + LoginSemaphore ??= OS.CreateCrossProcessSemaphore(nameof(LoginSemaphore) + webProxyText); WebLimitingSemaphores ??= new Dictionary(4, StringComparer.OrdinalIgnoreCase) { { nameof(ArchiWebHandler), (OS.CreateCrossProcessSemaphore(nameof(ArchiWebHandler) + webProxyText), new SemaphoreSlim(WebBrowser.MaxConnections, WebBrowser.MaxConnections)) }, diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 7edcdfe89..9ea181088 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -62,7 +62,6 @@ namespace ArchiSteamFarm { internal static EOSType OSType { get; private set; } = EOSType.Unknown; private static readonly SemaphoreSlim BotsSemaphore = new SemaphoreSlim(1, 1); - private static readonly SemaphoreSlim LoginSemaphore = new SemaphoreSlim(1, 1); [JsonIgnore] [PublicAPI] @@ -1938,8 +1937,8 @@ namespace ArchiSteamFarm { } private static async Task LimitLoginRequestsAsync() { - if (ASF.LoginRateLimitingSemaphore == null) { - ASF.ArchiLogger.LogNullError(nameof(ASF.LoginRateLimitingSemaphore)); + if ((ASF.LoginSemaphore == null) || (ASF.LoginRateLimitingSemaphore == null)) { + ASF.ArchiLogger.LogNullError(nameof(ASF.LoginSemaphore) + " || " + nameof(ASF.LoginRateLimitingSemaphore)); return; } @@ -1951,7 +1950,7 @@ namespace ArchiSteamFarm { return; } - await LoginSemaphore.WaitAsync().ConfigureAwait(false); + await ASF.LoginSemaphore.WaitAsync().ConfigureAwait(false); try { await ASF.LoginRateLimitingSemaphore.WaitAsync().ConfigureAwait(false); @@ -1960,7 +1959,7 @@ namespace ArchiSteamFarm { Utilities.InBackground( async () => { await Task.Delay(ASF.GlobalConfig.LoginLimiterDelay * 1000).ConfigureAwait(false); - LoginSemaphore.Release(); + ASF.LoginSemaphore.Release(); } ); }