diff --git a/src/SuperSocket.Connection/PipeConnection.cs b/src/SuperSocket.Connection/PipeConnection.cs index ac7778455..ead5ab92e 100644 --- a/src/SuperSocket.Connection/PipeConnection.cs +++ b/src/SuperSocket.Connection/PipeConnection.cs @@ -205,5 +205,10 @@ protected override bool IsIgnorableException(Exception e) return false; } + + protected override void CancelOutputPendingRead() + { + this.Output.Reader.CancelPendingRead(); + } } } diff --git a/src/SuperSocket.Connection/PipeConnectionBase.cs b/src/SuperSocket.Connection/PipeConnectionBase.cs index 436254b59..6da0ddcd2 100644 --- a/src/SuperSocket.Connection/PipeConnectionBase.cs +++ b/src/SuperSocket.Connection/PipeConnectionBase.cs @@ -147,6 +147,7 @@ protected async Task CancelAsync() _cts.Cancel(); await CompleteWriterAsync(OutputWriter, _isDetaching).ConfigureAwait(false); + CancelOutputPendingRead(); } protected virtual bool IsIgnorableException(Exception e) @@ -438,5 +439,9 @@ protected virtual async ValueTask CompleteWriterAsync(PipeWriter writer, bool is { await writer.CompleteAsync().ConfigureAwait(false); } + + protected virtual void CancelOutputPendingRead() + { + } } }