From 9f8ae75417f61519ec0b8c0a54cd2c5b5e2195e2 Mon Sep 17 00:00:00 2001 From: Kerry Jiang Date: Fri, 29 Mar 2024 22:20:12 -0700 Subject: [PATCH] fixed close reason and loca/remote endpoints for KestrelPipeConnection --- src/SuperSocket.Kestrel/KestrelPipeConnection.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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(); + } }