add toggle to for processing multiple requests

This commit is contained in:
2024-10-24 10:29:24 +02:00
parent c26be92734
commit cc8757b61e

View File

@@ -26,6 +26,8 @@ public class ApiServer(string apiUrl) : IApiServer
public bool DebugMode { get; set; } public bool DebugMode { get; set; }
public bool AllowMultipleRequests { get; set; }
public virtual void Start() public virtual void Start()
{ {
Log.Info("Start listening"); Log.Info("Start listening");
@@ -98,6 +100,7 @@ public class ApiServer(string apiUrl) : IApiServer
} }
// Immitatly listen for new request // Immitatly listen for new request
if (AllowMultipleRequests)
Receive(); Receive();
// Check context // Check context
@@ -111,6 +114,10 @@ public class ApiServer(string apiUrl) : IApiServer
if (DebugMode) if (DebugMode)
throw; throw;
} }
// Listen for new request
if (!AllowMultipleRequests)
Receive();
} }
protected virtual void CheckContext(HttpListenerContext context) protected virtual void CheckContext(HttpListenerContext context)