diff --git a/src/SuperSocket.Channel/TcpPipeChannel.cs b/src/SuperSocket.Channel/TcpPipeChannel.cs index 6b1a08924..0964c5c4d 100644 --- a/src/SuperSocket.Channel/TcpPipeChannel.cs +++ b/src/SuperSocket.Channel/TcpPipeChannel.cs @@ -76,6 +76,11 @@ protected override async ValueTask SendOverIOAsync(ReadOnlySequence b protected override void Close() { + if (this is IPipeChannel channel) + { + channel.PipelineFilter?.Reset(); + } + var socket = _socket; if (socket == null) diff --git a/src/SuperSocket.ProtoBase/PackagePartsPipelineFilter.cs b/src/SuperSocket.ProtoBase/PackagePartsPipelineFilter.cs index a77e38f97..1051fc71a 100644 --- a/src/SuperSocket.ProtoBase/PackagePartsPipelineFilter.cs +++ b/src/SuperSocket.ProtoBase/PackagePartsPipelineFilter.cs @@ -53,6 +53,8 @@ public virtual void Reset() { CurrentPackage = null; _currentPartReader = null; + Context = null; + NextFilter = null; } public object Context { get; set; } diff --git a/src/SuperSocket.WebSocket/WebSocketPipelineFilter.cs b/src/SuperSocket.WebSocket/WebSocketPipelineFilter.cs index c9b5da024..24ecbdf38 100644 --- a/src/SuperSocket.WebSocket/WebSocketPipelineFilter.cs +++ b/src/SuperSocket.WebSocket/WebSocketPipelineFilter.cs @@ -138,7 +138,9 @@ private HttpHeader ParseHttpHeaderItems(ref ReadOnlySequence header) public void Reset() { - + NextFilter = null; + Context = null; + GC.Collect(); } public object Context { get; set; }