Handle exceptions thrown from Connection.Start in ListenerSecondary

- This is already done for primary listeners
This commit is contained in:
Stephen Halter 2016-06-07 17:07:14 -07:00
parent 8dbdc0294f
commit b4632c273e
5 changed files with 10 additions and 7 deletions

View File

@ -138,8 +138,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
return; return;
} }
var connection = new Connection(this, acceptSocket); try
connection.Start(); {
var connection = new Connection(this, acceptSocket);
connection.Start();
}
catch (UvException ex)
{
Log.LogError(0, ex, "ListenerSecondary.OnConnection");
acceptSocket.Dispose();
}
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{ {
Log.LogError(0, ex, "PipeListener.OnConnection"); Log.LogError(0, ex, "PipeListener.OnConnection");
acceptSocket.Dispose(); acceptSocket.Dispose();
return;
} }
} }
} }

View File

@ -47,7 +47,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{ {
Log.LogError(0, ex, "ListenerPrimary.OnConnection"); Log.LogError(0, ex, "ListenerPrimary.OnConnection");
acceptSocket.Dispose(); acceptSocket.Dispose();
return;
} }
} }
} }

View File

@ -53,7 +53,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{ {
Log.LogError(0, ex, "TcpListener.OnConnection"); Log.LogError(0, ex, "TcpListener.OnConnection");
acceptSocket.Dispose(); acceptSocket.Dispose();
return;
} }
} }
} }

View File

@ -48,13 +48,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
acceptSocket.NoDelay(ServerOptions.NoDelay); acceptSocket.NoDelay(ServerOptions.NoDelay);
listenSocket.Accept(acceptSocket); listenSocket.Accept(acceptSocket);
DispatchConnection(acceptSocket); DispatchConnection(acceptSocket);
} }
catch (UvException ex) catch (UvException ex)
{ {
Log.LogError(0, ex, "TcpListenerPrimary.OnConnection"); Log.LogError(0, ex, "TcpListenerPrimary.OnConnection");
acceptSocket.Dispose(); acceptSocket.Dispose();
return;
} }
} }
} }