Obsolete the Libuv transport (#23480)
This commit is contained in:
parent
34a114530d
commit
197f156fcd
|
|
@ -63,17 +63,21 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LibuvTransportCanBeManuallySelectedIndependentOfOrder()
|
public void LibuvTransportCanBeManuallySelectedIndependentOfOrder()
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618
|
||||||
var hostBuilder = new WebHostBuilder()
|
var hostBuilder = new WebHostBuilder()
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.UseLibuv()
|
.UseLibuv()
|
||||||
.Configure(app => { });
|
.Configure(app => { });
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
Assert.IsType<LibuvTransportFactory>(hostBuilder.Build().Services.GetService<IConnectionListenerFactory>());
|
Assert.IsType<LibuvTransportFactory>(hostBuilder.Build().Services.GetService<IConnectionListenerFactory>());
|
||||||
|
|
||||||
|
#pragma warning disable CS0618
|
||||||
var hostBuilderReversed = new WebHostBuilder()
|
var hostBuilderReversed = new WebHostBuilder()
|
||||||
.UseLibuv()
|
.UseLibuv()
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.Configure(app => { });
|
.Configure(app => { });
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
Assert.IsType<LibuvTransportFactory>(hostBuilderReversed.Build().Services.GetService<IConnectionListenerFactory>());
|
Assert.IsType<LibuvTransportFactory>(hostBuilderReversed.Build().Services.GetService<IConnectionListenerFactory>());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
|
|
||||||
public IHostApplicationLifetime AppLifetime => TransportContext.AppLifetime;
|
public IHostApplicationLifetime AppLifetime => TransportContext.AppLifetime;
|
||||||
public ILibuvTrace Log => TransportContext.Log;
|
public ILibuvTrace Log => TransportContext.Log;
|
||||||
|
|
||||||
|
#pragma warning disable CS0618
|
||||||
public LibuvTransportOptions TransportOptions => TransportContext.Options;
|
public LibuvTransportOptions TransportOptions => TransportContext.Options;
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
public EndPoint EndPoint { get; set; }
|
public EndPoint EndPoint { get; set; }
|
||||||
|
|
||||||
|
|
@ -131,7 +134,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
{
|
{
|
||||||
// TODO: Move thread management to LibuvTransportFactory
|
// TODO: Move thread management to LibuvTransportFactory
|
||||||
// TODO: Split endpoint management from thread management
|
// TODO: Split endpoint management from thread management
|
||||||
|
#pragma warning disable CS0618
|
||||||
for (var index = 0; index < TransportOptions.ThreadCount; index++)
|
for (var index = 0; index < TransportOptions.ThreadCount; index++)
|
||||||
|
#pragma warning restore CS0618
|
||||||
{
|
{
|
||||||
Threads.Add(new LibuvThread(Libuv, TransportContext));
|
Threads.Add(new LibuvThread(Libuv, TransportContext));
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +148,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618
|
||||||
if (TransportOptions.ThreadCount == 1)
|
if (TransportOptions.ThreadCount == 1)
|
||||||
|
#pragma warning restore CS0618
|
||||||
{
|
{
|
||||||
var listener = new Listener(TransportContext);
|
var listener = new Listener(TransportContext);
|
||||||
_listeners.Add(listener);
|
_listeners.Add(listener);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
{
|
{
|
||||||
internal class LibuvTransportContext
|
internal class LibuvTransportContext
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618
|
||||||
public LibuvTransportOptions Options { get; set; }
|
public LibuvTransportOptions Options { get; set; }
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
public IHostApplicationLifetime AppLifetime { get; set; }
|
public IHostApplicationLifetime AppLifetime { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
private readonly LibuvTransportContext _baseTransportContext;
|
private readonly LibuvTransportContext _baseTransportContext;
|
||||||
|
|
||||||
public LibuvTransportFactory(
|
public LibuvTransportFactory(
|
||||||
|
#pragma warning disable CS0618
|
||||||
IOptions<LibuvTransportOptions> options,
|
IOptions<LibuvTransportOptions> options,
|
||||||
|
#pragma warning restore CS0618
|
||||||
IHostApplicationLifetime applicationLifetime,
|
IHostApplicationLifetime applicationLifetime,
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
|
|
@ -37,7 +39,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
var logger = loggerFactory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv");
|
var logger = loggerFactory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv");
|
||||||
var trace = new LibuvTrace(logger);
|
var trace = new LibuvTrace(logger);
|
||||||
|
|
||||||
|
#pragma warning disable CS0618
|
||||||
var threadCount = options.Value.ThreadCount;
|
var threadCount = options.Value.ThreadCount;
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
if (threadCount <= 0)
|
if (threadCount <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
return Thread.PostAsync(listener =>
|
return Thread.PostAsync(listener =>
|
||||||
{
|
{
|
||||||
listener.ListenSocket = listener.CreateListenSocket();
|
listener.ListenSocket = listener.CreateListenSocket();
|
||||||
|
#pragma warning disable CS0618
|
||||||
listener.ListenSocket.Listen(TransportContext.Options.Backlog, ConnectionCallback, listener);
|
listener.ListenSocket.Listen(TransportContext.Options.Backlog, ConnectionCallback, listener);
|
||||||
|
#pragma warning restore CS0618
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,7 +68,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
socket.Init(Thread.Loop, Thread.QueueCloseHandle);
|
socket.Init(Thread.Loop, Thread.QueueCloseHandle);
|
||||||
|
#pragma warning disable CS0618
|
||||||
socket.NoDelay(TransportContext.Options.NoDelay);
|
socket.NoDelay(TransportContext.Options.NoDelay);
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
if (!useFileHandle)
|
if (!useFileHandle)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = TransportContext.Options;
|
var options = TransportContext.Options;
|
||||||
|
#pragma warning disable CS0618
|
||||||
var connection = new LibuvConnection(socket, TransportContext.Log, Thread, remoteEndPoint, localEndPoint, InputOptions, OutputOptions, options.MaxReadBufferSize, options.MaxWriteBufferSize);
|
var connection = new LibuvConnection(socket, TransportContext.Log, Thread, remoteEndPoint, localEndPoint, InputOptions, OutputOptions, options.MaxReadBufferSize, options.MaxWriteBufferSize);
|
||||||
|
#pragma warning restore CS0618
|
||||||
connection.Start();
|
connection.Start();
|
||||||
|
|
||||||
bool accepted = _acceptQueue.Writer.TryWrite(connection);
|
bool accepted = _acceptQueue.Writer.TryWrite(connection);
|
||||||
|
|
@ -128,7 +130,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
socket.Init(Thread.Loop, Thread.QueueCloseHandle);
|
socket.Init(Thread.Loop, Thread.QueueCloseHandle);
|
||||||
|
#pragma warning disable CS0618
|
||||||
socket.NoDelay(TransportContext.Options.NoDelay);
|
socket.NoDelay(TransportContext.Options.NoDelay);
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
ListenPipe = new UvPipeHandle(Log);
|
ListenPipe = new UvPipeHandle(Log);
|
||||||
ListenPipe.Init(Thread.Loop, Thread.QueueCloseHandle, false);
|
ListenPipe.Init(Thread.Loop, Thread.QueueCloseHandle, false);
|
||||||
ListenPipe.Bind(_pipeName);
|
ListenPipe.Bind(_pipeName);
|
||||||
|
#pragma warning disable CS0618
|
||||||
ListenPipe.Listen(TransportContext.Options.Backlog,
|
ListenPipe.Listen(TransportContext.Options.Backlog,
|
||||||
(pipe, status, error, state) => ((ListenerPrimary)state).OnListenPipe(pipe, status, error), this);
|
(pipe, status, error, state) => ((ListenerPrimary)state).OnListenPipe(pipe, status, error), this);
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnListenPipe(UvStreamHandle pipe, int status, UvException error)
|
private void OnListenPipe(UvStreamHandle pipe, int status, UvException error)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides programmatic configuration of Libuv transport features.
|
/// Provides programmatic configuration of Libuv transport features.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public class LibuvTransportOptions
|
public class LibuvTransportOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -17,6 +18,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Defaults to half of <see cref="Environment.ProcessorCount" /> rounded down and clamped between 1 and 16.
|
/// Defaults to half of <see cref="Environment.ProcessorCount" /> rounded down and clamped between 1 and 16.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public int ThreadCount { get; set; } = ProcessorThreadCount;
|
public int ThreadCount { get; set; } = ProcessorThreadCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -25,6 +27,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Defaults to true.
|
/// Defaults to true.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public bool NoDelay { get; set; } = true;
|
public bool NoDelay { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -33,10 +36,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Defaults to 128.
|
/// Defaults to 128.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public int Backlog { get; set; } = 128;
|
public int Backlog { get; set; } = 128;
|
||||||
|
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public long? MaxReadBufferSize { get; set; } = 1024 * 1024;
|
public long? MaxReadBufferSize { get; set; } = 1024 * 1024;
|
||||||
|
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public long? MaxWriteBufferSize { get; set; } = 64 * 1024;
|
public long? MaxWriteBufferSize { get; set; } = 64 * 1024;
|
||||||
|
|
||||||
internal Func<MemoryPool<byte>> MemoryPoolFactory { get; set; } = System.Buffers.SlabMemoryPoolFactory.Create;
|
internal Func<MemoryPool<byte>> MemoryPoolFactory { get; set; } = System.Buffers.SlabMemoryPoolFactory.Create;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Hosting
|
namespace Microsoft.AspNetCore.Hosting
|
||||||
{
|
{
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public static class WebHostBuilderLibuvExtensions
|
public static class WebHostBuilderLibuvExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -20,6 +21,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder.
|
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder)
|
public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder)
|
||||||
{
|
{
|
||||||
return hostBuilder.ConfigureServices(services =>
|
return hostBuilder.ConfigureServices(services =>
|
||||||
|
|
@ -40,6 +42,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder.
|
/// The Microsoft.AspNetCore.Hosting.IWebHostBuilder.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
|
[Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)]
|
||||||
public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder, Action<LibuvTransportOptions> configureOptions)
|
public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder, Action<LibuvTransportOptions> configureOptions)
|
||||||
{
|
{
|
||||||
return hostBuilder.UseLibuv().ConfigureServices(services =>
|
return hostBuilder.UseLibuv().ConfigureServices(services =>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
[InlineData(-1337)]
|
[InlineData(-1337)]
|
||||||
public void StartWithNonPositiveThreadCountThrows(int threadCount)
|
public void StartWithNonPositiveThreadCountThrows(int threadCount)
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618
|
||||||
var options = new LibuvTransportOptions { ThreadCount = threadCount };
|
var options = new LibuvTransportOptions { ThreadCount = threadCount };
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
|
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||||
new LibuvTransportFactory(Options.Create(options), new LifetimeNotImplemented(), Mock.Of<ILoggerFactory>()));
|
new LibuvTransportFactory(Options.Create(options), new LifetimeNotImplemented(), Mock.Of<ILoggerFactory>()));
|
||||||
|
|
@ -30,7 +32,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
public void LoggerCategoryNameIsLibuvTransportNamespace()
|
public void LoggerCategoryNameIsLibuvTransportNamespace()
|
||||||
{
|
{
|
||||||
var mockLoggerFactory = new Mock<ILoggerFactory>();
|
var mockLoggerFactory = new Mock<ILoggerFactory>();
|
||||||
|
#pragma warning disable CS0618
|
||||||
new LibuvTransportFactory(Options.Create<LibuvTransportOptions>(new LibuvTransportOptions()), new LifetimeNotImplemented(), mockLoggerFactory.Object);
|
new LibuvTransportFactory(Options.Create<LibuvTransportOptions>(new LibuvTransportOptions()), new LifetimeNotImplemented(), mockLoggerFactory.Object);
|
||||||
|
#pragma warning restore CS0618
|
||||||
mockLoggerFactory.Verify(factory => factory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv"));
|
mockLoggerFactory.Verify(factory => factory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
// Ideally we'd mock Environment.ProcessorCount to test edge cases.
|
// Ideally we'd mock Environment.ProcessorCount to test edge cases.
|
||||||
var expected = Clamp(Environment.ProcessorCount >> 1, 1, 16);
|
var expected = Clamp(Environment.ProcessorCount >> 1, 1, 16);
|
||||||
|
|
||||||
|
#pragma warning disable CS0618
|
||||||
var information = new LibuvTransportOptions();
|
var information = new LibuvTransportOptions();
|
||||||
|
|
||||||
Assert.Equal(expected, information.ThreadCount);
|
Assert.Equal(expected, information.ThreadCount);
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Clamp(int value, int min, int max)
|
private static int Clamp(int value, int min, int max)
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
var transportContext = new TestLibuvTransportContext
|
var transportContext = new TestLibuvTransportContext
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618
|
||||||
Options = new LibuvTransportOptions { ThreadCount = threadCount }
|
Options = new LibuvTransportOptions { ThreadCount = threadCount }
|
||||||
|
#pragma warning restore CS0618
|
||||||
};
|
};
|
||||||
|
|
||||||
await using var transport = new LibuvConnectionListener(transportContext, listenOptions.EndPoint);
|
await using var transport = new LibuvConnectionListener(transportContext, listenOptions.EndPoint);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.TestHelpers
|
||||||
|
|
||||||
AppLifetime = new LifetimeNotImplemented();
|
AppLifetime = new LifetimeNotImplemented();
|
||||||
Log = new LibuvTrace(logger);
|
Log = new LibuvTrace(logger);
|
||||||
|
#pragma warning disable CS0618
|
||||||
Options = new LibuvTransportOptions { ThreadCount = 1 };
|
Options = new LibuvTransportOptions { ThreadCount = 1 };
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,11 +157,13 @@ namespace SampleApp
|
||||||
if (string.Equals(Process.GetCurrentProcess().Id.ToString(), Environment.GetEnvironmentVariable("LISTEN_PID")))
|
if (string.Equals(Process.GetCurrentProcess().Id.ToString(), Environment.GetEnvironmentVariable("LISTEN_PID")))
|
||||||
{
|
{
|
||||||
// Use libuv if activated by systemd, since that's currently the only transport that supports being passed a socket handle.
|
// Use libuv if activated by systemd, since that's currently the only transport that supports being passed a socket handle.
|
||||||
|
#pragma warning disable CS0618
|
||||||
hostBuilder.UseLibuv(options =>
|
hostBuilder.UseLibuv(options =>
|
||||||
{
|
{
|
||||||
// Uncomment the following line to change the default number of libuv threads for all endpoints.
|
// Uncomment the following line to change the default number of libuv threads for all endpoints.
|
||||||
// options.ThreadCount = 4;
|
// options.ThreadCount = 4;
|
||||||
});
|
});
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
return hostBuilder.Build().RunAsync();
|
return hostBuilder.Build().RunAsync();
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,13 @@ namespace SystemdTestApp
|
||||||
if (string.Equals(Process.GetCurrentProcess().Id.ToString(), Environment.GetEnvironmentVariable("LISTEN_PID")))
|
if (string.Equals(Process.GetCurrentProcess().Id.ToString(), Environment.GetEnvironmentVariable("LISTEN_PID")))
|
||||||
{
|
{
|
||||||
// Use libuv if activated by systemd, since that's currently the only transport that supports being passed a socket handle.
|
// Use libuv if activated by systemd, since that's currently the only transport that supports being passed a socket handle.
|
||||||
|
#pragma warning disable CS0618
|
||||||
hostBuilder.UseLibuv(options =>
|
hostBuilder.UseLibuv(options =>
|
||||||
{
|
{
|
||||||
// Uncomment the following line to change the default number of libuv threads for all endpoints.
|
// Uncomment the following line to change the default number of libuv threads for all endpoints.
|
||||||
// options.ThreadCount = 4;
|
// options.ThreadCount = 4;
|
||||||
});
|
});
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
return hostBuilder.Build().RunAsync();
|
return hostBuilder.Build().RunAsync();
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
||||||
public static IWebHostBuilder GetWebHostBuilder(Func<MemoryPool<byte>> memoryPoolFactory = null,
|
public static IWebHostBuilder GetWebHostBuilder(Func<MemoryPool<byte>> memoryPoolFactory = null,
|
||||||
long? maxReadBufferSize = null)
|
long? maxReadBufferSize = null)
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618
|
||||||
return new WebHostBuilder().UseLibuv(options =>
|
return new WebHostBuilder().UseLibuv(options =>
|
||||||
{
|
{
|
||||||
options.MemoryPoolFactory = memoryPoolFactory ?? options.MemoryPoolFactory;
|
options.MemoryPoolFactory = memoryPoolFactory ?? options.MemoryPoolFactory;
|
||||||
options.MaxReadBufferSize = maxReadBufferSize;
|
options.MaxReadBufferSize = maxReadBufferSize;
|
||||||
});
|
});
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue