From cc8757b61eb8deb69894554b6f7c07362e5f5185 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Thu, 24 Oct 2024 10:29:24 +0200 Subject: [PATCH] add toggle to for processing multiple requests --- Pilz.Net/Api/ApiServer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Pilz.Net/Api/ApiServer.cs b/Pilz.Net/Api/ApiServer.cs index b02a64c..ce30082 100644 --- a/Pilz.Net/Api/ApiServer.cs +++ b/Pilz.Net/Api/ApiServer.cs @@ -26,6 +26,8 @@ public class ApiServer(string apiUrl) : IApiServer public bool DebugMode { get; set; } + public bool AllowMultipleRequests { get; set; } + public virtual void Start() { Log.Info("Start listening"); @@ -98,7 +100,8 @@ public class ApiServer(string apiUrl) : IApiServer } // Immitatly listen for new request - Receive(); + if (AllowMultipleRequests) + Receive(); // Check context try @@ -111,6 +114,10 @@ public class ApiServer(string apiUrl) : IApiServer if (DebugMode) throw; } + + // Listen for new request + if (!AllowMultipleRequests) + Receive(); } protected virtual void CheckContext(HttpListenerContext context)