-
Notifications
You must be signed in to change notification settings - Fork 10.7k
ConnectionContext.Transport.Output.CompleteAsync() should only half close connection #14937
Copy link
Copy link
Open
Open
Copy link
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-kestrelseverity-nice-to-haveThis label is used by an internal toolThis label is used by an internal tool🥌 Bedrock
Milestone
Metadata
Metadata
Assignees
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-kestrelseverity-nice-to-haveThis label is used by an internal toolThis label is used by an internal tool🥌 Bedrock
Type
Fields
Give feedbackNo fields configured for Feature.
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.