Skip to content

Commit

Permalink
Remove scheduling mode
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed May 27, 2019
1 parent ba6ae60 commit 77d3c27
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 53 deletions.
3 changes: 0 additions & 3 deletions src/Servers/Kestrel/samples/Http2SampleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public static void Main(string[] args)
{
var basePort = context.Configuration.GetValue<int?>("BASE_PORT") ?? 5000;
// Run callbacks on the transport thread
options.ApplicationSchedulingMode = SchedulingMode.Inline;
// Http/1.1 endpoint for comparison
options.Listen(IPAddress.Any, basePort, listenOptions =>
{
Expand Down
44 changes: 1 addition & 43 deletions src/Servers/Kestrel/samples/PlaintextApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets;

namespace PlaintextApp
{
Expand Down Expand Up @@ -40,52 +39,11 @@ public static async Task Main(string[] args)
{
options.Listen(IPAddress.Loopback, 5001);
})
// .UseLibuv()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();

var hostTask = host.RunAsync();
var serverTask = ServerAsync(new SocketTransportFactory(), 5002);

await hostTask;;
}

private static async Task ServerAsync(IConnectionListenerFactory factory, int port)
{
await using var listener = await factory.BindAsync(new IPEndPoint(IPAddress.Loopback, port));

while (true)
{
var connection = await listener.AcceptAsync();

// Fire and forget so we can handle more than a single connection at a time
_ = HandleConnectionAsync(connection);

static async Task HandleConnectionAsync(ConnectionContext connection)
{
await using (connection)
{
while (true)
{
var result = await connection.Transport.Input.ReadAsync();
var buffer = result.Buffer;

foreach (var segment in buffer)
{
await connection.Transport.Output.WriteAsync(segment);
}

if (result.IsCompleted)
{
break;
}

connection.Transport.Input.AdvanceTo(buffer.End);
}
}
}
}
await host.RunAsync();
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/Servers/Kestrel/samples/SampleApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ public static Task Main(string[] args)
httpsOptions.SslProtocols = SslProtocols.Tls12;
});
// Run callbacks on the transport thread
options.ApplicationSchedulingMode = SchedulingMode.Inline;
options.Listen(IPAddress.Loopback, basePort, listenOptions =>
{
// Uncomment the following to enable Nagle's algorithm for this endpoint.
Expand Down
5 changes: 1 addition & 4 deletions src/Servers/Kestrel/samples/SystemdTestApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ public static Task Main(string[] args)
{
var basePort = context.Configuration.GetValue<int?>("BASE_PORT") ?? 5000;
// Run callbacks on the transport thread
options.ApplicationSchedulingMode = SchedulingMode.Inline;
options.Listen(IPAddress.Loopback, basePort, listenOptions =>
{
// Uncomment the following to enable Nagle's algorithm for this endpoint.
Expand Down Expand Up @@ -89,4 +86,4 @@ public static Task Main(string[] args)
return hostBuilder.Build().RunAsync();
}
}
}
}

0 comments on commit 77d3c27

Please sign in to comment.