Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit b4632c2

Browse files
committed
Handle exceptions thrown from Connection.Start in ListenerSecondary
- This is already done for primary listeners
1 parent 8dbdc02 commit b4632c2

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/ListenerSecondary.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,16 @@ private void ReadStartCallback(UvStreamHandle handle, int status)
138138
return;
139139
}
140140

141-
var connection = new Connection(this, acceptSocket);
142-
connection.Start();
141+
try
142+
{
143+
var connection = new Connection(this, acceptSocket);
144+
connection.Start();
145+
}
146+
catch (UvException ex)
147+
{
148+
Log.LogError(0, ex, "ListenerSecondary.OnConnection");
149+
acceptSocket.Dispose();
150+
}
143151
}
144152

145153
/// <summary>

src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/PipeListener.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ protected override void OnConnection(UvStreamHandle listenSocket, int status)
4747
{
4848
Log.LogError(0, ex, "PipeListener.OnConnection");
4949
acceptSocket.Dispose();
50-
return;
5150
}
5251
}
5352
}

src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/PipeListenerPrimary.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ protected override void OnConnection(UvStreamHandle listenSocket, int status)
4747
{
4848
Log.LogError(0, ex, "ListenerPrimary.OnConnection");
4949
acceptSocket.Dispose();
50-
return;
5150
}
5251
}
5352
}

src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/TcpListener.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ protected override void OnConnection(UvStreamHandle listenSocket, int status)
5353
{
5454
Log.LogError(0, ex, "TcpListener.OnConnection");
5555
acceptSocket.Dispose();
56-
return;
5756
}
5857
}
5958
}

src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/TcpListenerPrimary.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,11 @@ protected override void OnConnection(UvStreamHandle listenSocket, int status)
4848
acceptSocket.NoDelay(ServerOptions.NoDelay);
4949
listenSocket.Accept(acceptSocket);
5050
DispatchConnection(acceptSocket);
51-
5251
}
5352
catch (UvException ex)
5453
{
5554
Log.LogError(0, ex, "TcpListenerPrimary.OnConnection");
5655
acceptSocket.Dispose();
57-
return;
5856
}
5957
}
6058
}

0 commit comments

Comments
 (0)