Skip to content

Commit

Permalink
HTTP->ServerResponse -> improve the way of close connection
Browse files Browse the repository at this point in the history
HTTP->ServerResponse -> improve the way of close connection
  • Loading branch information
alec1o committed Jun 27, 2024
1 parent 1170582 commit 19cfd03
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/http/partials/Server/HTTP.ServerResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,18 @@ private void WriteAndSend(int statusCode)
}
catch (Exception e)
{
// TODO: Handle it
Console.WriteLine($"{nameof(ServerRequest)} -> {nameof(Send)}: {e}");
try
{
_response.Close();
}
catch (Exception exception)
{
Console.WriteLine($"[#1] {nameof(ServerRequest)} -> {nameof(Send)}: {exception}");
}
finally
{
Console.WriteLine($"[#2] {nameof(ServerRequest)} -> {nameof(Send)}: {e}");
}
}
});
}
Expand Down

0 comments on commit 19cfd03

Please sign in to comment.