Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fowler <davidfowl@gmail.com>2022-08-22 23:25:48 +0300
committerDavid Fowler <davidfowl@gmail.com>2022-08-22 23:25:48 +0300
commit0293cb9b74911aa5ac286943c221ac50a1485db9 (patch)
tree686f5ab03fc8014f9615ad9ed8b0d3f35843e894
parent6a3f8725fc6d03b6b5c599ddf438dc00f24c38cc (diff)
Remove the double dispatch on Windows for IOdavidfowl/remove-double-dispatch
- The windows IO thread pool was replaced with one that dispatches to the thread pool. As a result, we remove the extra thread pool dispatch that we originally had for windows because continuations for IO on windows ran on the same thread that polls for IO.
-rw-r--r--src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs9
-rw-r--r--src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs10
2 files changed, 5 insertions, 14 deletions
diff --git a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs
index ccfabeb310..fc1be0b47e 100644
--- a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs
+++ b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketConnection.cs
@@ -33,7 +33,7 @@ internal sealed partial class SocketConnection : TransportConnection
internal SocketConnection(Socket socket,
MemoryPool<byte> memoryPool,
- PipeScheduler transportScheduler,
+ PipeScheduler socketScheduler,
ILogger logger,
SocketSenderPool socketSenderPool,
PipeOptions inputOptions,
@@ -55,12 +55,7 @@ internal sealed partial class SocketConnection : TransportConnection
ConnectionClosed = _connectionClosedTokenSource.Token;
- // On *nix platforms, Sockets already dispatches to the ThreadPool.
- // Yes, the IOQueues are still used for the PipeSchedulers. This is intentional.
- // https://github.com/aspnet/KestrelHttpServer/issues/2573
- var awaiterScheduler = OperatingSystem.IsWindows() ? transportScheduler : PipeScheduler.Inline;
-
- _receiver = new SocketReceiver(awaiterScheduler);
+ _receiver = new SocketReceiver(socketScheduler);
var pair = DuplexPipe.CreateConnectionPair(inputOptions, outputOptions);
diff --git a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs
index 11e3aca312..4bd06f5cb6 100644
--- a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs
+++ b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionContextFactory.cs
@@ -56,15 +56,13 @@ public sealed class SocketConnectionContextFactory : IDisposable
{
var memoryPool = _options.MemoryPoolFactory();
var transportScheduler = options.UnsafePreferInlineScheduling ? PipeScheduler.Inline : new IOQueue();
- // https://github.com/aspnet/KestrelHttpServer/issues/2573
- var awaiterScheduler = OperatingSystem.IsWindows() ? transportScheduler : PipeScheduler.Inline;
_settings[i] = new QueueSettings()
{
Scheduler = transportScheduler,
InputOptions = new PipeOptions(memoryPool, applicationScheduler, transportScheduler, maxReadBufferSize, maxReadBufferSize / 2, useSynchronizationContext: false),
OutputOptions = new PipeOptions(memoryPool, transportScheduler, applicationScheduler, maxWriteBufferSize, maxWriteBufferSize / 2, useSynchronizationContext: false),
- SocketSenderPool = new SocketSenderPool(awaiterScheduler),
+ SocketSenderPool = new SocketSenderPool(transportScheduler),
MemoryPool = memoryPool,
};
}
@@ -73,8 +71,6 @@ public sealed class SocketConnectionContextFactory : IDisposable
{
var memoryPool = _options.MemoryPoolFactory();
var transportScheduler = options.UnsafePreferInlineScheduling ? PipeScheduler.Inline : PipeScheduler.ThreadPool;
- // https://github.com/aspnet/KestrelHttpServer/issues/2573
- var awaiterScheduler = OperatingSystem.IsWindows() ? transportScheduler : PipeScheduler.Inline;
_settings = new QueueSettings[]
{
new QueueSettings()
@@ -82,7 +78,7 @@ public sealed class SocketConnectionContextFactory : IDisposable
Scheduler = transportScheduler,
InputOptions = new PipeOptions(memoryPool, applicationScheduler, transportScheduler, maxReadBufferSize, maxReadBufferSize / 2, useSynchronizationContext: false),
OutputOptions = new PipeOptions(memoryPool, transportScheduler, applicationScheduler, maxWriteBufferSize, maxWriteBufferSize / 2, useSynchronizationContext: false),
- SocketSenderPool = new SocketSenderPool(awaiterScheduler),
+ SocketSenderPool = new SocketSenderPool(PipeScheduler.Inline),
MemoryPool = memoryPool,
}
};
@@ -101,7 +97,7 @@ public sealed class SocketConnectionContextFactory : IDisposable
var connection = new SocketConnection(socket,
setting.MemoryPool,
- setting.Scheduler,
+ PipeScheduler.Inline,
_logger,
setting.SocketSenderPool,
setting.InputOptions,