Skip to content

Commit 8041dd1

Browse files
committed
Drop MultiplexedConnectionMarkerService
1 parent d1f386d commit 8041dd1

File tree

10 files changed

+12
-50
lines changed

10 files changed

+12
-50
lines changed

src/Servers/Connections.Abstractions/src/MultiplexedConnectionMarkerService.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Servers/Connections.Abstractions/src/PublicAPI/net462/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature
33
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.get -> System.IO.Pipes.NamedPipeServerStream!
44
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
55
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
6-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService
7-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService.MultiplexedConnectionMarkerService() -> void
86
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
97
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
108
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void
119
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.PipeName.get -> string!
1210
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ServerName.get -> string!
1311
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.Equals(object? obj) -> bool
1412
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.GetHashCode() -> int
15-
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!
13+
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!

src/Servers/Connections.Abstractions/src/PublicAPI/net8.0/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.
44
Microsoft.AspNetCore.Connections.Features.ITlsHandshakeFeature.NegotiatedCipherSuite.get -> System.Net.Security.TlsCipherSuite?
55
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
66
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
7-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService
8-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService.MultiplexedConnectionMarkerService() -> void
97
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
108
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
119
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void

src/Servers/Connections.Abstractions/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature
33
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.get -> System.IO.Pipes.NamedPipeServerStream!
44
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
55
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
6-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService
7-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService.MultiplexedConnectionMarkerService() -> void
86
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
97
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
108
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void
119
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.PipeName.get -> string!
1210
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ServerName.get -> string!
1311
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.Equals(object? obj) -> bool
1412
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.GetHashCode() -> int
15-
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!
13+
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!

src/Servers/Connections.Abstractions/src/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature
33
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.get -> System.IO.Pipes.NamedPipeServerStream!
44
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
55
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
6-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService
7-
Microsoft.AspNetCore.Connections.MultiplexedConnectionMarkerService.MultiplexedConnectionMarkerService() -> void
86
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
97
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
108
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void
119
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.PipeName.get -> string!
1210
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ServerName.get -> string!
1311
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.Equals(object? obj) -> bool
1412
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.GetHashCode() -> int
15-
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!
13+
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!

src/Servers/Kestrel/Core/src/Internal/KestrelServerImpl.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ async Task OnBind(ListenOptions options, CancellationToken onBindCancellationTok
125125

126126
if (hasHttp3 && !haveMultiplexedFactories)
127127
{
128-
if (Options.ApplicationServices.GetService(typeof(MultiplexedConnectionMarkerService)) is null)
128+
// There will be a IMultiplexedConnectionListenerFactory iff UseQuic was called
129+
if (options.ProtocolsSetExplicitly && Options.ApplicationServices.GetService(typeof(IMultiplexedConnectionListenerFactory)) is null)
129130
{
130131
throw new InvalidOperationException("You need to call UseQuic"); // TODO (acasey): message
131132
}

src/Servers/Kestrel/Core/test/KestrelServerTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ private KestrelServerOptions CreateServerOptions()
3131
var serverOptions = new KestrelServerOptions();
3232
serverOptions.ApplicationServices = new ServiceCollection()
3333
.AddLogging()
34-
.AddSingleton<MultiplexedConnectionMarkerService>()
3534
.BuildServiceProvider();
3635
return serverOptions;
3736
}

src/Servers/Kestrel/Transport.Quic/src/QuicTransportFactory.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics;
45
using System.Net;
6+
using System.Net.Quic;
57
using Microsoft.AspNetCore.Connections;
68
using Microsoft.AspNetCore.Http.Features;
79
using Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal;
@@ -38,6 +40,7 @@ public QuicTransportFactory(ILoggerFactory loggerFactory, IOptions<QuicTransport
3840
public async ValueTask<IMultiplexedConnectionListener> BindAsync(EndPoint endpoint, IFeatureCollection? features = null, CancellationToken cancellationToken = default)
3941
{
4042
ArgumentNullException.ThrowIfNull(endpoint);
43+
Debug.Assert(CanBind(endpoint));
4144

4245
var tlsConnectionOptions = features?.Get<TlsConnectionCallbackOptions>();
4346

@@ -58,6 +61,6 @@ public async ValueTask<IMultiplexedConnectionListener> BindAsync(EndPoint endpoi
5861

5962
public bool CanBind(EndPoint endpoint)
6063
{
61-
return endpoint is IPEndPoint;
64+
return endpoint is IPEndPoint && QuicListener.IsSupported;
6265
}
6366
}

src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Net.Quic;
54
using Microsoft.AspNetCore.Connections;
65
using Microsoft.AspNetCore.Server.Kestrel.Transport.Quic;
76
using Microsoft.Extensions.DependencyInjection;
@@ -20,22 +19,11 @@ public static class WebHostBuilderQuicExtensions
2019
/// <returns>The <see cref="IWebHostBuilder"/>.</returns>
2120
public static IWebHostBuilder UseQuic(this IWebHostBuilder hostBuilder)
2221
{
23-
// In order to be able to provide useful error messages in slim scenarios, we have to be able
24-
// to distinguish between QUIC-was-not-requested and QUIC-is-not-available.
25-
hostBuilder.ConfigureServices(services =>
22+
return hostBuilder.ConfigureServices(services =>
2623
{
27-
services.AddSingleton<MultiplexedConnectionMarkerService>();
24+
// CanBind will return false if QuicListener.IsSupported is false
25+
services.AddSingleton<IMultiplexedConnectionListenerFactory, QuicTransportFactory>();
2826
});
29-
30-
if (QuicListener.IsSupported)
31-
{
32-
return hostBuilder.ConfigureServices(services =>
33-
{
34-
services.AddSingleton<IMultiplexedConnectionListenerFactory, QuicTransportFactory>();
35-
});
36-
}
37-
38-
return hostBuilder;
3927
}
4028

4129
/// <summary>

src/Servers/Kestrel/test/InMemory.FunctionalTests/TestTransport/TestServer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ public TestServer(RequestDelegate app, TestServiceContext context, Action<Kestre
8888
services.AddSingleton<IStartup>(this);
8989
services.AddSingleton(context.LoggerFactory);
9090

91-
// TODO (acasey): this feels like a hack and will likely make it hard to test the real feature
92-
services.AddSingleton<MultiplexedConnectionMarkerService>();
93-
9491
services.AddSingleton<IServer>(sp =>
9592
{
9693
context.ServerOptions.ApplicationServices = sp;

0 commit comments

Comments
 (0)