another improvement

This commit is contained in:
2025-02-06 15:00:46 +01:00
parent 295644087f
commit ab67023ea4

View File

@@ -280,17 +280,12 @@ public class ApiServer : IApiServer
if (AllowMultipleRequests)
Receive();
// Cancel if we don't have a context
if (context is null)
{
FreeSlot();
return;
}
// Check context
var success = false;
if (context is not null)
{
Log.Info("Request retrived for " + context.Request.RawUrl);
OnCheckContext?.Invoke(this, new(context));
var success = false;
try
{
CheckContext(context);
@@ -306,13 +301,14 @@ public class ApiServer : IApiServer
{
OnCheckContextCompleted?.Invoke(this, new(context));
}
}
// Try closing the request on fail
if (!success)
{
try
{
context.Response.Close();
context?.Response.Close();
}
catch (Exception)
{