Skip to content

Commit

Permalink
Merge pull request #26 from shdwp/master
Browse files Browse the repository at this point in the history
Fixed NullReference if socket was closed too fast.
  • Loading branch information
jchristn authored Aug 23, 2019
2 parents b9cb8d4 + 6d25f84 commit 502c952
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions WatsonWebserver/WatsonWebserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,14 @@ private void AcceptConnections(CancellationToken token)
if (token.IsCancellationRequested) throw new OperationCanceledException();
var context = c as HttpListenerContext;
Events.ConnectionReceived(
context.Request.RemoteEndPoint.Address.ToString(),
context.Request.RemoteEndPoint.Port);
HttpRequest req = null;
try
{
Events.ConnectionReceived(
context.Request.RemoteEndPoint.Address.ToString(),
context.Request.RemoteEndPoint.Port);
// Populate HTTP request object
req = new HttpRequest(context, ReadInputStream);
if (req == null)
Expand Down

0 comments on commit 502c952

Please sign in to comment.