Skip to content

Support side-by-side transports in Kestrel #44657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 1, 2022

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Oct 20, 2022

Fixes #44537

I didn't override the sockets or QUIC transports to have a CanBind implementation. I figure that they will always be present as the final fallback transports.

@JamesNK JamesNK changed the title Support multiple transports in Kestrel Support side-transports in Kestrel Oct 20, 2022
@JamesNK JamesNK changed the title Support side-transports in Kestrel Support side-by-side transports in Kestrel Oct 20, 2022
@JamesNK JamesNK force-pushed the jamesnk/kestrel-multiple-transports branch from 339ddb2 to 0e2b680 Compare October 28, 2022 06:17
@JamesNK
Copy link
Member Author

JamesNK commented Oct 28, 2022

Updated to match API review. Please take a look 🙏

@@ -1,6 +1,8 @@
#nullable enable
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature.OnClosed(System.Action<object?>! callback, object? state) -> void
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dotnet/aspnet-build It looks like we need to Update our PublicAPI baselines now that we're adding new APIs for .NET 8.

We'll have to be careful not to include IPNetwork.Parse/TryParse and RequestLocalizationOptions.CultureInfoUseUserOverride in the .NET 7 baseline. I think those are the only APIs we've added since branching for .NET 8.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once 7.0.0 ships, we'll update the baselines. But not until then. That'll involve changes in release/7.0 and copying the Shipped files into main, then patching things up to reflect the new APIs in Unshipped files.

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from wanting to wait for the public API baseline update, this looks good to me.

@dougbu
Copy link
Contributor

dougbu commented Oct 28, 2022

Aside from wanting to wait for the public API baseline update

Up to you whether you wait. Some patching / conflict resolution will be needed either way.

@halter73
Copy link
Member

So far, before this PR, the things we've added in .NET 8 have been new in their respective PublicAPI.txt files. I suspect this will make fixing those up relatively easier than doing it for this PR.

Once 7.0.0 ships, we'll update the baselines. But not until then. That'll involve changes in release/7.0 and copying the Shipped files into main, then patching things up to reflect the new APIs in Unshipped files.

Can we do this now since were not adding any more new APIs to .NET 7? If not, does this mean will do this on November 8?

@dougbu
Copy link
Contributor

dougbu commented Oct 28, 2022

I suspect this will make fixing those up relatively easier than doing it for this PR.

It doesn't really matter -- as long as the Shipped files haven't been touched in main recently. The Unshipped ➡️ Shipped process moves everything currently in the 7.0 Unshipped files and empties them out. Then we'll check the 7.0 files into main and will have to manually update the Unshipped files.

does this mean will do this on November 8?

We'll do it on the 8th because that's when the APIs truly have shipped.

@JamesNK
Copy link
Member Author

JamesNK commented Oct 29, 2022

So, can I merge this? It sounds like it can be merged, but I want to double check.

This PR dependency of other another, so I’d like to merge it.

@dougbu
Copy link
Contributor

dougbu commented Oct 29, 2022

So, can I merge this?

If someone approves the changes, they're fine w/ me.

@JamesNK JamesNK enabled auto-merge (squash) October 30, 2022 04:09
@JamesNK
Copy link
Member Author

JamesNK commented Nov 1, 2022

@halter73 Could you approve so I can merge?


private static bool CanBindFactory(EndPoint endPoint, IConnectionListenerFactorySelector? selector)
{
// By default, the last registered factory binds to the endpoint.
Copy link
Member

@Tratcher Tratcher Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you ensure the last wins? Are you relying on the order of items in the DI injected Lists? I thought those lists where given in the order added, so you'd have to reverse it to get the last one first?

edit Nevermind, I found the Reverse call in KestrelServerImpl.

/// This interface should be implemented by <see cref="IConnectionListenerFactory"/> and <see cref="IMultiplexedConnectionListenerFactory"/>
/// types that want to control want endpoint instances they can bind to.
/// </remarks>
public interface IConnectionListenerFactorySelector
Copy link
Member

@Tratcher Tratcher Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we implement this on the socket transport and restrict it to known endpoints?

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I also agree with idea of implementing IConnectionListenerFactorySelector on the socket transport. Don't see why not.

@JamesNK JamesNK merged commit c8d252d into main Nov 1, 2022
@JamesNK JamesNK deleted the jamesnk/kestrel-multiple-transports branch November 1, 2022 20:35
@ghost ghost added this to the 8.0-preview1 milestone Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kestrel: Support for multiple transports, side-by-side
5 participants