From ffccb98d7959681e38b261a3fef3b1bcd794af9c Mon Sep 17 00:00:00 2001 From: Archi Date: Mon, 27 Dec 2021 16:03:33 +0100 Subject: [PATCH] Fix NRE in WebLimitRequest() This was possible if plugin triggered WebLimitRequest() for unrecognized service. --- ArchiSteamFarm/Core/ASF.cs | 2 ++ ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/ArchiSteamFarm/Core/ASF.cs b/ArchiSteamFarm/Core/ASF.cs index 7ff65b2f0..f94aed3c9 100644 --- a/ArchiSteamFarm/Core/ASF.cs +++ b/ArchiSteamFarm/Core/ASF.cs @@ -69,6 +69,8 @@ public static class ASF { [PublicAPI] public static WebBrowser? WebBrowser { get; private set; } + internal static readonly SemaphoreSlim OpenConnectionsSemaphore = new(WebBrowser.MaxConnections, WebBrowser.MaxConnections); + internal static ICrossProcessSemaphore? ConfirmationsSemaphore { get; private set; } internal static ICrossProcessSemaphore? GiftsSemaphore { get; private set; } internal static ICrossProcessSemaphore? InventorySemaphore { get; private set; } diff --git a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs index 50c2f6041..191326d6d 100644 --- a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs +++ b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs @@ -1181,6 +1181,7 @@ public sealed class ArchiWebHandler : IDisposable { ASF.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(service), service)); limiters.RateLimitingSemaphore = ASF.RateLimitingSemaphore; + limiters.OpenConnectionsSemaphore = ASF.OpenConnectionsSemaphore; } // Sending a request opens a new connection