dotnet / dotnet/aspnetcore

ConnectionContext.Transport.Output.CompleteAsync() should only half close connection

Open
#14,937 2 comments 4 reactions 1 assignee Claimed by @davidfowl View on GitHub
affected-very-few area-networking enhancement feature-kestrel severity-nice-to-have 🥌 Bedrock
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

Today ConnectionContext.Transport.Output.CompleteAsync() fully closes the connection with both the libuv and managed socket transport. As soon as the transport send loop sees a completed ReadResult, it calls Socket.Shutdown(SocketShutdown.Both) or an equivalent. This prevents the application from reading more from ConnectionContext.Transport.Input even if the other side of the connection did not finish sending data.

Given that ConnectionContext.DisposeAsync() now exists and also fully closes the connection, the contract for ConnectionContext.Transport.Output.CompleteAsync() should change to only close the sending side of the connection. The converse should also be true for ConnectionContext.Transport.Input.CompleteAsync(). DisposeAsync() should continue to fully close the connection after the send loop completes like it does today, and Abort() will continue to immediately terminate the connection.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.