Skip to content

Commit

Permalink
When kestrelconnection DetachAsync does not call reader.Complete()
Browse files Browse the repository at this point in the history
  • Loading branch information
wj8400684 committed Dec 9, 2024
1 parent 96eaf4a commit 7ec3ad6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/SuperSocket.Connection/PipeConnectionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ protected async Task ReadPipeAsync<TPackageInfo>(PipeReader reader, IObjectPipe<
}
}

reader.Complete();
OnReaderComplete(reader, _isDetaching);
WriteEOFPackage();
}

Expand Down Expand Up @@ -413,5 +413,10 @@ protected void OnError(string message, Exception e = null)
else
Logger?.LogError(message);
}

protected virtual void OnReaderComplete(PipeReader reader, bool isDetaching)
{
reader.Complete();
}
}
}
8 changes: 8 additions & 0 deletions src/SuperSocket.Kestrel/KestrelPipeConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,12 @@ protected override Task StartInputPipeTask<TPackageInfo>(IObjectPipe<TPackageInf

return base.StartInputPipeTask(packagePipe, cancellationToken);
}

protected override void OnReaderComplete(PipeReader reader, bool isDetaching)
{
if (isDetaching)
return;

reader.Complete();
}
}

0 comments on commit 7ec3ad6

Please sign in to comment.