Add IConnectionLifetimeFeature to Microsoft.AspNetCore.Connections.Abstractions
davidfowl opened this issue · 7 comments
public interface IConnectionLifetimeFeature
{
CancellationToken ConnectionClosed { get; }
void Abort();
}
These should also be exposed on ConnectionContext
Related to: #1980
Putting this in 2.2 milestone for now (like the other bedrock items).
I don't think that Abort
should be exposed directly on ConnectionContext
.
As it is, ConnectionContext
has a very clean API: The Transport
which is the core reason why this type exists and two extensibility properties (Features
and Items
).
Anything else would feel too specific.
(I can give a pass to ConnectionId
because it is a simple property and it is useful for logging.)
By the way, should Abort
be async-capable?
I don't think that Abort should be exposed directly on ConnectionContext.
I think it needs to be. It's way to directly communicate with the underlying transport skipping all indirections (the Transport pipe might have been replaced).
By the way, should Abort be async-capable?
I don't think so. It's a signal, fire and forget.
I updated the interface.
This interface will be available through the Features
property. And that's what that property is there for.
I just don't understand why it also needs to be "hard-coded" into ConnectionContext
.
Because every connection needs the ability to be aborted and that is a distinct feature from completing the transport.
Tracking the dev work.
This is now in 2.1 and our dev branches.