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