Skip to content

Consider letting the transport own the creation of IDuplexPipe #4752

@davidfowl

Description

@davidfowl

Today the transport is responsible for exposing properties on the connection that can be used by Kestrel to create a duplex pipe. It does this today for a few reasons:

  • It wants to directly apply the MaxResponseBufferSize and MaxRequestBuffer size to pipe options
  • It communicates "fin" via cancelling the transport's output reader (this is super hacky and we should get rid of it anyways).
  • It wants to control where "user code" runs. This includes:
    • ConnectionAdapters (soon to be deprecated)
    • CancellationToken callbacks
    • the request processing delegate

Delegating to the transport has some other benefits:

  • Transports aren't tied to a specific pipe implementation.
  • We can potentially delete ITransportSchedulerFeature, IApplicationTransportFeature

To make this change though, we need to pass the relevant settings from kestrel to the transport without coupling. My current though is to pass a settings object to ITransportFactory.Create.

See https://github.com/geoffkizer/KestrelHttpServer/blob/7bd21cdb1581fc3559479842262a24deecf171bb/src/Kestrel.Transport.Sockets/Internal/SocketConnection.cs for an example of the socket transport with a direct pipe implementation.

/cc @tmds @benaadams (only other people that wrote transports 😄)

Metadata

Metadata

Assignees

Labels

acceptedThis issue has completed "acceptance" testing (including accessibility)area-networkingIncludes 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 onefeature-kestrel🥌 Bedrock

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions