Skip to content

Commit

Permalink
Fixed NullReference if socket was closed too fast.
Browse files Browse the repository at this point in the history
  • Loading branch information
shdwp authored Aug 23, 2019
1 parent b9cb8d4 commit 6d25f84
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 6d25f84

Please sign in to comment.