diff --git a/Pilz.Net/Api/ApiServer.cs b/Pilz.Net/Api/ApiServer.cs index e24f0c3..b15979b 100644 --- a/Pilz.Net/Api/ApiServer.cs +++ b/Pilz.Net/Api/ApiServer.cs @@ -98,7 +98,7 @@ public class ApiServer(string apiUrl) : IApiServer protected virtual void WaitForSlot() { - if (MaxConcurentConnections == int.MaxValue) + if (!AllowMultipleRequests) return; // Unlimited in this case semaphore ??= new(MaxConcurentConnections, MaxConcurentConnections); semaphore.Wait(); @@ -257,7 +257,10 @@ public class ApiServer(string apiUrl) : IApiServer // Listen for new request if (!AllowMultipleRequests) + { + FreeSlot(); Receive(); + } } protected virtual void CheckContext(HttpListenerContext context)