diff --git a/src/SuperSocket.Kestrel/KestrelPipeConnection.cs b/src/SuperSocket.Kestrel/KestrelPipeConnection.cs index d4da3b5bc..37f0a888a 100644 --- a/src/SuperSocket.Kestrel/KestrelPipeConnection.cs +++ b/src/SuperSocket.Kestrel/KestrelPipeConnection.cs @@ -14,6 +14,9 @@ public KestrelPipeConnection(ConnectionContext context, ConnectionOptions option : base(context.Transport.Input, context.Transport.Output, options) { _context = context; + context.ConnectionClosed.Register(() => OnClosed()); + LocalEndPoint = context.LocalEndPoint; + RemoteEndPoint = context.RemoteEndPoint; } protected override async void Close() @@ -28,4 +31,12 @@ protected override async void Close() await context.DisposeAsync(); } } + + protected override void OnClosed() + { + if (!CloseReason.HasValue) + CloseReason = Connection.CloseReason.RemoteClosing; + + base.OnClosed(); + } }