Don't capture connection on closure

This commit is contained in:
Ben Adams 2015-11-01 13:27:17 +00:00
parent facf3ad0da
commit ea6f6b10dc
1 changed files with 6 additions and 4 deletions

View File

@ -13,8 +13,10 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
{ {
public class Connection : ConnectionContext, IConnectionControl public class Connection : ConnectionContext, IConnectionControl
{ {
private static readonly Action<UvStreamHandle, int, object> _readCallback = ReadCallback; private static readonly Action<UvStreamHandle, int, object> _readCallback =
private static readonly Func<UvStreamHandle, int, object, Libuv.uv_buf_t> _allocCallback = AllocCallback; (handle, status, state) => ReadCallback(handle, status, state);
private static readonly Func<UvStreamHandle, int, object, Libuv.uv_buf_t> _allocCallback =
(handle, suggestedsize, state) => AllocCallback(handle, suggestedsize, state);
private static long _lastConnectionId; private static long _lastConnectionId;
@ -83,12 +85,12 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
if (task.IsFaulted) if (task.IsFaulted)
{ {
connection.Log.LogError("ConnectionFilter.OnConnection", task.Exception); connection.Log.LogError("ConnectionFilter.OnConnection", task.Exception);
ConnectionControl.End(ProduceEndType.SocketDisconnect); connection.ConnectionControl.End(ProduceEndType.SocketDisconnect);
} }
else if (task.IsCanceled) else if (task.IsCanceled)
{ {
connection.Log.LogError("ConnectionFilter.OnConnection Canceled"); connection.Log.LogError("ConnectionFilter.OnConnection Canceled");
ConnectionControl.End(ProduceEndType.SocketDisconnect); connection.ConnectionControl.End(ProduceEndType.SocketDisconnect);
} }
else else
{ {