Upgrade package references and react to corefx API changes (#2212)
This commit is contained in:
parent
edebfc1bb9
commit
95dc8824c3
|
|
@ -23,8 +23,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
[IterationSetup]
|
[IterationSetup]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var bufferPool = new MemoryPool();
|
var memoryPool = new MemoryPool();
|
||||||
var pair = PipeFactory.CreateConnectionPair(bufferPool);
|
var pair = PipeFactory.CreateConnectionPair(memoryPool);
|
||||||
|
|
||||||
var serviceContext = new ServiceContext
|
var serviceContext = new ServiceContext
|
||||||
{
|
{
|
||||||
|
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = bufferPool,
|
MemoryPool = memoryPool,
|
||||||
TimeoutControl = new MockTimeoutControl(),
|
TimeoutControl = new MockTimeoutControl(),
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport
|
Transport = pair.Transport
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = memoryPool,
|
MemoryPool = memoryPool,
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport
|
Transport = pair.Transport
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
|
|
||||||
public HttpProtocolFeatureCollection()
|
public HttpProtocolFeatureCollection()
|
||||||
{
|
{
|
||||||
var bufferPool = new MemoryPool();
|
var memoryPool = new MemoryPool();
|
||||||
var pair = PipeFactory.CreateConnectionPair(bufferPool);
|
var pair = PipeFactory.CreateConnectionPair(memoryPool);
|
||||||
|
|
||||||
var serviceContext = new ServiceContext
|
var serviceContext = new ServiceContext
|
||||||
{
|
{
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = bufferPool,
|
MemoryPool = memoryPool,
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport
|
Transport = pair.Transport
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
private const int InnerLoopCount = 512;
|
private const int InnerLoopCount = 512;
|
||||||
|
|
||||||
private IPipe _pipe;
|
private IPipe _pipe;
|
||||||
private BufferPool _bufferPool;
|
private MemoryPool _memoryPool;
|
||||||
|
|
||||||
[IterationSetup]
|
[IterationSetup]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_bufferPool = new MemoryPool();
|
_memoryPool = new MemoryPool();
|
||||||
_pipe = new Pipe(new PipeOptions(_bufferPool));
|
_pipe = new Pipe(new PipeOptions(_memoryPool));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Benchmark(OperationsPerInvoke = InnerLoopCount)]
|
[Benchmark(OperationsPerInvoke = InnerLoopCount)]
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
[IterationSetup]
|
[IterationSetup]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var bufferPool = new MemoryPool();
|
var memoryPool = new MemoryPool();
|
||||||
var pair = PipeFactory.CreateConnectionPair(bufferPool);
|
var pair = PipeFactory.CreateConnectionPair(memoryPool);
|
||||||
|
|
||||||
var serviceContext = new ServiceContext
|
var serviceContext = new ServiceContext
|
||||||
{
|
{
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = bufferPool,
|
MemoryPool = memoryPool,
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport,
|
Transport = pair.Transport,
|
||||||
TimeoutControl = new MockTimeoutControl()
|
TimeoutControl = new MockTimeoutControl()
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
http1Connection.Reset();
|
http1Connection.Reset();
|
||||||
|
|
||||||
Http1Connection = http1Connection;
|
Http1Connection = http1Connection;
|
||||||
Pipe = new Pipe(new PipeOptions(bufferPool));
|
Pipe = new Pipe(new PipeOptions(memoryPool));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Benchmark(Baseline = true, OperationsPerInvoke = RequestParsingData.InnerLoopCount)]
|
[Benchmark(Baseline = true, OperationsPerInvoke = RequestParsingData.InnerLoopCount)]
|
||||||
|
|
|
||||||
|
|
@ -171,8 +171,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
[IterationSetup]
|
[IterationSetup]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var bufferPool = new MemoryPool();
|
var memoryPool = new MemoryPool();
|
||||||
var pair = PipeFactory.CreateConnectionPair(bufferPool);
|
var pair = PipeFactory.CreateConnectionPair(memoryPool);
|
||||||
|
|
||||||
var serviceContext = new ServiceContext
|
var serviceContext = new ServiceContext
|
||||||
{
|
{
|
||||||
|
|
@ -186,7 +186,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = bufferPool,
|
MemoryPool = memoryPool,
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport
|
Transport = pair.Transport
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
[IterationSetup]
|
[IterationSetup]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
var bufferPool = new MemoryPool();
|
var memoryPool = new MemoryPool();
|
||||||
var pair = PipeFactory.CreateConnectionPair(bufferPool);
|
var pair = PipeFactory.CreateConnectionPair(memoryPool);
|
||||||
|
|
||||||
var serviceContext = new ServiceContext
|
var serviceContext = new ServiceContext
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = bufferPool,
|
MemoryPool = memoryPool,
|
||||||
TimeoutControl = new MockTimeoutControl(),
|
TimeoutControl = new MockTimeoutControl(),
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport
|
Transport = pair.Transport
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<!-- This files is typically managed by automation. Execute 'run.ps1 upgrade deps' to update these variables to the last-known-good versions. -->
|
<!-- This files is typically managed by automation. Execute 'run.ps1 upgrade deps' to update these variables to the last-known-good versions. -->
|
||||||
<PropertyGroup Label="Package Versions">
|
<PropertyGroup Label="Package Versions">
|
||||||
<BenchmarkDotNetPackageVersion>0.10.9</BenchmarkDotNetPackageVersion>
|
<BenchmarkDotNetPackageVersion>0.10.9</BenchmarkDotNetPackageVersion>
|
||||||
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15618</InternalAspNetCoreSdkPackageVersion>
|
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15620</InternalAspNetCoreSdkPackageVersion>
|
||||||
<LibuvPackageVersion>1.10.0</LibuvPackageVersion>
|
<LibuvPackageVersion>1.10.0</LibuvPackageVersion>
|
||||||
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview1-27773</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
|
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview1-27773</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
|
||||||
<MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>2.1.0-preview1-27773</MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>
|
<MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>2.1.0-preview1-27773</MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>
|
||||||
|
|
@ -22,20 +22,20 @@
|
||||||
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview1-27773</MicrosoftExtensionsLoggingTestingPackageVersion>
|
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview1-27773</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||||
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview1-27773</MicrosoftExtensionsOptionsPackageVersion>
|
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview1-27773</MicrosoftExtensionsOptionsPackageVersion>
|
||||||
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
||||||
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview1-25915-01</MicrosoftNETCoreApp21PackageVersion>
|
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview1-26008-01</MicrosoftNETCoreApp21PackageVersion>
|
||||||
<MicrosoftNetHttpHeadersPackageVersion>2.1.0-preview1-27773</MicrosoftNetHttpHeadersPackageVersion>
|
<MicrosoftNetHttpHeadersPackageVersion>2.1.0-preview1-27773</MicrosoftNetHttpHeadersPackageVersion>
|
||||||
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
|
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
|
||||||
<MoqPackageVersion>4.7.49</MoqPackageVersion>
|
<MoqPackageVersion>4.7.49</MoqPackageVersion>
|
||||||
<NewtonsoftJsonPackageVersion>10.0.1</NewtonsoftJsonPackageVersion>
|
<NewtonsoftJsonPackageVersion>10.0.1</NewtonsoftJsonPackageVersion>
|
||||||
<SystemBuffersPackageVersion>4.5.0-preview1-25914-04</SystemBuffersPackageVersion>
|
<SystemBuffersPackageVersion>4.5.0-preview1-26006-06</SystemBuffersPackageVersion>
|
||||||
<SystemIOPipelinesPackageVersion>0.1.0-alpha-002</SystemIOPipelinesPackageVersion>
|
<SystemIOPipelinesPackageVersion>0.1.0-e171206-2</SystemIOPipelinesPackageVersion>
|
||||||
<SystemIOPipelinesTestingPackageVersion>0.1.0-alpha-002</SystemIOPipelinesTestingPackageVersion>
|
<SystemIOPipelinesTestingPackageVersion>0.1.0-e171206-2</SystemIOPipelinesTestingPackageVersion>
|
||||||
<SystemMemoryPackageVersion>4.5.0-preview1-25914-04</SystemMemoryPackageVersion>
|
<SystemMemoryPackageVersion>4.5.0-preview1-26006-06</SystemMemoryPackageVersion>
|
||||||
<SystemNumericsVectorsPackageVersion>4.5.0-preview1-25914-04</SystemNumericsVectorsPackageVersion>
|
<SystemNumericsVectorsPackageVersion>4.5.0-preview1-26006-06</SystemNumericsVectorsPackageVersion>
|
||||||
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview1-25914-04</SystemRuntimeCompilerServicesUnsafePackageVersion>
|
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview1-26006-06</SystemRuntimeCompilerServicesUnsafePackageVersion>
|
||||||
<SystemSecurityCryptographyCngPackageVersion>4.5.0-preview1-25914-04</SystemSecurityCryptographyCngPackageVersion>
|
<SystemSecurityCryptographyCngPackageVersion>4.5.0-preview1-26006-06</SystemSecurityCryptographyCngPackageVersion>
|
||||||
<SystemTextEncodingsWebUtf8PackageVersion>0.1.0-alpha-002</SystemTextEncodingsWebUtf8PackageVersion>
|
<SystemTextEncodingsWebUtf8PackageVersion>0.1.0-e171206-2</SystemTextEncodingsWebUtf8PackageVersion>
|
||||||
<SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview2-25707-02</SystemThreadingTasksExtensionsPackageVersion>
|
<SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview1-26006-06</SystemThreadingTasksExtensionsPackageVersion>
|
||||||
<XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion>
|
<XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion>
|
||||||
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
||||||
<XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>
|
<XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
version:2.1.0-preview1-15618
|
version:2.1.0-preview1-15620
|
||||||
commithash:00ce1383114015fe89b221146036e59e6bc11219
|
commithash:6432b49a2c00310416df39b6fe548ef4af9c6011
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
|
|
||||||
// REVIEW: Unfortunately, we still need to use the service context to create the pipes since the settings
|
// REVIEW: Unfortunately, we still need to use the service context to create the pipes since the settings
|
||||||
// for the scheduler and limits are specified here
|
// for the scheduler and limits are specified here
|
||||||
var inputOptions = GetInputPipeOptions(_serviceContext, connectionContext.BufferPool, transportFeature.InputWriterScheduler);
|
var inputOptions = GetInputPipeOptions(_serviceContext, connectionContext.MemoryPool, transportFeature.InputWriterScheduler);
|
||||||
var outputOptions = GetOutputPipeOptions(_serviceContext, connectionContext.BufferPool, transportFeature.OutputReaderScheduler);
|
var outputOptions = GetOutputPipeOptions(_serviceContext, connectionContext.MemoryPool, transportFeature.OutputReaderScheduler);
|
||||||
|
|
||||||
var pair = PipeFactory.CreateConnectionPair(inputOptions, outputOptions);
|
var pair = PipeFactory.CreateConnectionPair(inputOptions, outputOptions);
|
||||||
|
|
||||||
|
|
@ -83,18 +83,18 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal for testing
|
// Internal for testing
|
||||||
internal static PipeOptions GetInputPipeOptions(ServiceContext serviceContext, BufferPool bufferPool, IScheduler writerScheduler) => new PipeOptions
|
internal static PipeOptions GetInputPipeOptions(ServiceContext serviceContext, MemoryPool memoryPool, IScheduler writerScheduler) => new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: bufferPool,
|
pool: memoryPool,
|
||||||
readerScheduler: serviceContext.ThreadPool,
|
readerScheduler: serviceContext.ThreadPool,
|
||||||
writerScheduler: writerScheduler,
|
writerScheduler: writerScheduler,
|
||||||
maximumSizeHigh: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0,
|
maximumSizeHigh: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0,
|
||||||
maximumSizeLow: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0
|
maximumSizeLow: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0
|
||||||
);
|
);
|
||||||
|
|
||||||
internal static PipeOptions GetOutputPipeOptions(ServiceContext serviceContext, BufferPool bufferPool, IScheduler readerScheduler) => new PipeOptions
|
internal static PipeOptions GetOutputPipeOptions(ServiceContext serviceContext, MemoryPool memoryPool, IScheduler readerScheduler) => new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: bufferPool,
|
pool: memoryPool,
|
||||||
readerScheduler: readerScheduler,
|
readerScheduler: readerScheduler,
|
||||||
writerScheduler: serviceContext.ThreadPool,
|
writerScheduler: serviceContext.ThreadPool,
|
||||||
maximumSizeHigh: GetOutputResponseBufferSize(serviceContext),
|
maximumSizeHigh: GetOutputResponseBufferSize(serviceContext),
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
||||||
public string ConnectionId { get; set; }
|
public string ConnectionId { get; set; }
|
||||||
public ServiceContext ServiceContext { get; set; }
|
public ServiceContext ServiceContext { get; set; }
|
||||||
public IFeatureCollection ConnectionFeatures { get; set; }
|
public IFeatureCollection ConnectionFeatures { get; set; }
|
||||||
public BufferPool BufferPool { get; set; }
|
public MemoryPool MemoryPool { get; set; }
|
||||||
public IPEndPoint RemoteEndPoint { get; set; }
|
public IPEndPoint RemoteEndPoint { get; set; }
|
||||||
public IPEndPoint LocalEndPoint { get; set; }
|
public IPEndPoint LocalEndPoint { get; set; }
|
||||||
public ITimeoutControl TimeoutControl { get; set; }
|
public ITimeoutControl TimeoutControl { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1300,7 +1300,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
||||||
private Pipe CreateRequestBodyPipe()
|
private Pipe CreateRequestBodyPipe()
|
||||||
=> new Pipe(new PipeOptions
|
=> new Pipe(new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _context.BufferPool,
|
pool: _context.MemoryPool,
|
||||||
readerScheduler: ServiceContext.ThreadPool,
|
readerScheduler: ServiceContext.ThreadPool,
|
||||||
writerScheduler: InlineScheduler.Default,
|
writerScheduler: InlineScheduler.Default,
|
||||||
maximumSizeHigh: 1,
|
maximumSizeHigh: 1,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
||||||
string ConnectionId { get; set; }
|
string ConnectionId { get; set; }
|
||||||
ServiceContext ServiceContext { get; set; }
|
ServiceContext ServiceContext { get; set; }
|
||||||
IFeatureCollection ConnectionFeatures { get; set; }
|
IFeatureCollection ConnectionFeatures { get; set; }
|
||||||
BufferPool BufferPool { get; set; }
|
MemoryPool MemoryPool { get; set; }
|
||||||
IPEndPoint RemoteEndPoint { get; set; }
|
IPEndPoint RemoteEndPoint { get; set; }
|
||||||
IPEndPoint LocalEndPoint { get; set; }
|
IPEndPoint LocalEndPoint { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
|
||||||
StreamId = _incomingFrame.StreamId,
|
StreamId = _incomingFrame.StreamId,
|
||||||
ServiceContext = _context.ServiceContext,
|
ServiceContext = _context.ServiceContext,
|
||||||
ConnectionFeatures = _context.ConnectionFeatures,
|
ConnectionFeatures = _context.ConnectionFeatures,
|
||||||
BufferPool = _context.BufferPool,
|
MemoryPool = _context.MemoryPool,
|
||||||
LocalEndPoint = _context.LocalEndPoint,
|
LocalEndPoint = _context.LocalEndPoint,
|
||||||
RemoteEndPoint = _context.RemoteEndPoint,
|
RemoteEndPoint = _context.RemoteEndPoint,
|
||||||
StreamLifetimeHandler = this,
|
StreamLifetimeHandler = this,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
|
||||||
public string ConnectionId { get; set; }
|
public string ConnectionId { get; set; }
|
||||||
public ServiceContext ServiceContext { get; set; }
|
public ServiceContext ServiceContext { get; set; }
|
||||||
public IFeatureCollection ConnectionFeatures { get; set; }
|
public IFeatureCollection ConnectionFeatures { get; set; }
|
||||||
public BufferPool BufferPool { get; set; }
|
public MemoryPool MemoryPool { get; set; }
|
||||||
public IPEndPoint LocalEndPoint { get; set; }
|
public IPEndPoint LocalEndPoint { get; set; }
|
||||||
public IPEndPoint RemoteEndPoint { get; set; }
|
public IPEndPoint RemoteEndPoint { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
|
||||||
public int StreamId { get; set; }
|
public int StreamId { get; set; }
|
||||||
public ServiceContext ServiceContext { get; set; }
|
public ServiceContext ServiceContext { get; set; }
|
||||||
public IFeatureCollection ConnectionFeatures { get; set; }
|
public IFeatureCollection ConnectionFeatures { get; set; }
|
||||||
public BufferPool BufferPool { get; set; }
|
public MemoryPool MemoryPool { get; set; }
|
||||||
public IPEndPoint RemoteEndPoint { get; set; }
|
public IPEndPoint RemoteEndPoint { get; set; }
|
||||||
public IPEndPoint LocalEndPoint { get; set; }
|
public IPEndPoint LocalEndPoint { get; set; }
|
||||||
public IHttp2StreamLifetimeHandler StreamLifetimeHandler { get; set; }
|
public IHttp2StreamLifetimeHandler StreamLifetimeHandler { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
public IPEndPoint LocalEndPoint => _context.LocalEndPoint;
|
public IPEndPoint LocalEndPoint => _context.LocalEndPoint;
|
||||||
public IPEndPoint RemoteEndPoint => _context.RemoteEndPoint;
|
public IPEndPoint RemoteEndPoint => _context.RemoteEndPoint;
|
||||||
|
|
||||||
private BufferPool BufferPool => _context.BufferPool;
|
private MemoryPool MemoryPool => _context.MemoryPool;
|
||||||
|
|
||||||
// Internal for testing
|
// Internal for testing
|
||||||
internal PipeOptions AdaptedInputPipeOptions => new PipeOptions
|
internal PipeOptions AdaptedInputPipeOptions => new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: BufferPool,
|
pool: MemoryPool,
|
||||||
readerScheduler: _context.ServiceContext.ThreadPool,
|
readerScheduler: _context.ServiceContext.ThreadPool,
|
||||||
writerScheduler: InlineScheduler.Default,
|
writerScheduler: InlineScheduler.Default,
|
||||||
maximumSizeHigh: _context.ServiceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0,
|
maximumSizeHigh: _context.ServiceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0,
|
||||||
|
|
@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
|
|
||||||
internal PipeOptions AdaptedOutputPipeOptions => new PipeOptions
|
internal PipeOptions AdaptedOutputPipeOptions => new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: BufferPool,
|
pool: MemoryPool,
|
||||||
readerScheduler: InlineScheduler.Default,
|
readerScheduler: InlineScheduler.Default,
|
||||||
writerScheduler: InlineScheduler.Default,
|
writerScheduler: InlineScheduler.Default,
|
||||||
maximumSizeHigh: _context.ServiceContext.ServerOptions.Limits.MaxResponseBufferSize ?? 0,
|
maximumSizeHigh: _context.ServiceContext.ServerOptions.Limits.MaxResponseBufferSize ?? 0,
|
||||||
|
|
@ -203,7 +203,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
{
|
{
|
||||||
ConnectionId = _context.ConnectionId,
|
ConnectionId = _context.ConnectionId,
|
||||||
ConnectionFeatures = _context.ConnectionFeatures,
|
ConnectionFeatures = _context.ConnectionFeatures,
|
||||||
BufferPool = BufferPool,
|
MemoryPool = MemoryPool,
|
||||||
LocalEndPoint = LocalEndPoint,
|
LocalEndPoint = LocalEndPoint,
|
||||||
RemoteEndPoint = RemoteEndPoint,
|
RemoteEndPoint = RemoteEndPoint,
|
||||||
ServiceContext = _context.ServiceContext,
|
ServiceContext = _context.ServiceContext,
|
||||||
|
|
@ -220,7 +220,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
ConnectionId = _context.ConnectionId,
|
ConnectionId = _context.ConnectionId,
|
||||||
ServiceContext = _context.ServiceContext,
|
ServiceContext = _context.ServiceContext,
|
||||||
ConnectionFeatures = _context.ConnectionFeatures,
|
ConnectionFeatures = _context.ConnectionFeatures,
|
||||||
BufferPool = BufferPool,
|
MemoryPool = MemoryPool,
|
||||||
LocalEndPoint = LocalEndPoint,
|
LocalEndPoint = LocalEndPoint,
|
||||||
RemoteEndPoint = RemoteEndPoint,
|
RemoteEndPoint = RemoteEndPoint,
|
||||||
Application = application,
|
Application = application,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
public ServiceContext ServiceContext { get; set; }
|
public ServiceContext ServiceContext { get; set; }
|
||||||
public IFeatureCollection ConnectionFeatures { get; set; }
|
public IFeatureCollection ConnectionFeatures { get; set; }
|
||||||
public IList<IConnectionAdapter> ConnectionAdapters { get; set; }
|
public IList<IConnectionAdapter> ConnectionAdapters { get; set; }
|
||||||
public BufferPool BufferPool { get; set; }
|
public MemoryPool MemoryPool { get; set; }
|
||||||
public IPEndPoint LocalEndPoint { get; set; }
|
public IPEndPoint LocalEndPoint { get; set; }
|
||||||
public IPEndPoint RemoteEndPoint { get; set; }
|
public IPEndPoint RemoteEndPoint { get; set; }
|
||||||
public IPipeConnection Transport { get; set; }
|
public IPipeConnection Transport { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
|
||||||
Protocols = _protocols,
|
Protocols = _protocols,
|
||||||
ServiceContext = _serviceContext,
|
ServiceContext = _serviceContext,
|
||||||
ConnectionFeatures = connectionContext.Features,
|
ConnectionFeatures = connectionContext.Features,
|
||||||
BufferPool = connectionContext.BufferPool,
|
MemoryPool = connectionContext.MemoryPool,
|
||||||
ConnectionAdapters = _connectionAdapters,
|
ConnectionAdapters = _connectionAdapters,
|
||||||
Transport = connectionContext.Transport,
|
Transport = connectionContext.Transport,
|
||||||
Application = transportFeature.Application
|
Application = transportFeature.Application
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal
|
||||||
set => LocalPort = value;
|
set => LocalPort = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferPool IConnectionTransportFeature.BufferPool => BufferPool;
|
MemoryPool IConnectionTransportFeature.MemoryPool => MemoryPool;
|
||||||
|
|
||||||
IPipeConnection IConnectionTransportFeature.Transport
|
IPipeConnection IConnectionTransportFeature.Transport
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal
|
||||||
|
|
||||||
public string ConnectionId { get; set; }
|
public string ConnectionId { get; set; }
|
||||||
|
|
||||||
public virtual BufferPool BufferPool { get; }
|
public virtual MemoryPool MemoryPool { get; }
|
||||||
public virtual IScheduler InputWriterScheduler { get; }
|
public virtual IScheduler InputWriterScheduler { get; }
|
||||||
public virtual IScheduler OutputReaderScheduler { get; }
|
public virtual IScheduler OutputReaderScheduler { get; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
|
|
||||||
public ListenerContext ListenerContext { get; set; }
|
public ListenerContext ListenerContext { get; set; }
|
||||||
|
|
||||||
public override BufferPool BufferPool => ListenerContext.Thread.BufferPool;
|
public override MemoryPool MemoryPool => ListenerContext.Thread.MemoryPool;
|
||||||
public override IScheduler InputWriterScheduler => ListenerContext.Thread;
|
public override IScheduler InputWriterScheduler => ListenerContext.Thread;
|
||||||
public override IScheduler OutputReaderScheduler => ListenerContext.Thread;
|
public override IScheduler OutputReaderScheduler => ListenerContext.Thread;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
#endif
|
#endif
|
||||||
QueueCloseHandle = PostCloseHandle;
|
QueueCloseHandle = PostCloseHandle;
|
||||||
QueueCloseAsyncHandle = EnqueueCloseHandle;
|
QueueCloseAsyncHandle = EnqueueCloseHandle;
|
||||||
BufferPool = new MemoryPool();
|
MemoryPool = new MemoryPool();
|
||||||
WriteReqPool = new WriteReqPool(this, _log);
|
WriteReqPool = new WriteReqPool(this, _log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
|
|
||||||
public UvLoopHandle Loop { get { return _loop; } }
|
public UvLoopHandle Loop { get { return _loop; } }
|
||||||
|
|
||||||
public BufferPool BufferPool { get; }
|
public MemoryPool MemoryPool { get; }
|
||||||
|
|
||||||
public WriteReqPool WriteReqPool { get; }
|
public WriteReqPool WriteReqPool { get; }
|
||||||
|
|
||||||
|
|
@ -296,7 +296,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
BufferPool.Dispose();
|
MemoryPool.Dispose();
|
||||||
WriteReqPool.Dispose();
|
WriteReqPool.Dispose();
|
||||||
_threadTcs.SetResult(null);
|
_threadTcs.SetResult(null);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
|
|
||||||
private volatile bool _aborted;
|
private volatile bool _aborted;
|
||||||
|
|
||||||
internal SocketConnection(Socket socket, BufferPool bufferPool, ISocketsTrace trace)
|
internal SocketConnection(Socket socket, MemoryPool memoryPool, ISocketsTrace trace)
|
||||||
{
|
{
|
||||||
Debug.Assert(socket != null);
|
Debug.Assert(socket != null);
|
||||||
Debug.Assert(bufferPool != null);
|
Debug.Assert(memoryPool != null);
|
||||||
Debug.Assert(trace != null);
|
Debug.Assert(trace != null);
|
||||||
|
|
||||||
_socket = socket;
|
_socket = socket;
|
||||||
BufferPool = bufferPool;
|
MemoryPool = memoryPool;
|
||||||
_trace = trace;
|
_trace = trace;
|
||||||
|
|
||||||
var localEndPoint = (IPEndPoint)_socket.LocalEndPoint;
|
var localEndPoint = (IPEndPoint)_socket.LocalEndPoint;
|
||||||
|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
_sender = new SocketSender(_socket);
|
_sender = new SocketSender(_socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BufferPool BufferPool { get; }
|
public override MemoryPool MemoryPool { get; }
|
||||||
public override IScheduler InputWriterScheduler => InlineScheduler.Default;
|
public override IScheduler InputWriterScheduler => InlineScheduler.Default;
|
||||||
public override IScheduler OutputReaderScheduler => TaskRunScheduler.Default;
|
public override IScheduler OutputReaderScheduler => TaskRunScheduler.Default;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
return SendAsync(buffers.First);
|
return SendAsync(buffers.First);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if NETCOREAPP2_1
|
||||||
|
if (!_eventArgs.MemoryBuffer.Equals(Memory<byte>.Empty))
|
||||||
|
#else
|
||||||
if (_eventArgs.Buffer != null)
|
if (_eventArgs.Buffer != null)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
_eventArgs.SetBuffer(null, 0, 0);
|
_eventArgs.SetBuffer(null, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
|
||||||
{
|
{
|
||||||
internal sealed class SocketTransport : ITransport
|
internal sealed class SocketTransport : ITransport
|
||||||
{
|
{
|
||||||
private readonly BufferPool _bufferPool = new MemoryPool();
|
private readonly MemoryPool _memoryPool = new MemoryPool();
|
||||||
private readonly IEndPointInformation _endPointInformation;
|
private readonly IEndPointInformation _endPointInformation;
|
||||||
private readonly IConnectionHandler _handler;
|
private readonly IConnectionHandler _handler;
|
||||||
private readonly IApplicationLifetime _appLifetime;
|
private readonly IApplicationLifetime _appLifetime;
|
||||||
|
|
@ -116,7 +116,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
|
||||||
|
|
||||||
public Task StopAsync()
|
public Task StopAsync()
|
||||||
{
|
{
|
||||||
_bufferPool.Dispose();
|
_memoryPool.Dispose();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
|
||||||
var acceptSocket = await _listenSocket.AcceptAsync();
|
var acceptSocket = await _listenSocket.AcceptAsync();
|
||||||
acceptSocket.NoDelay = _endPointInformation.NoDelay;
|
acceptSocket.NoDelay = _endPointInformation.NoDelay;
|
||||||
|
|
||||||
var connection = new SocketConnection(acceptSocket, _bufferPool, _trace);
|
var connection = new SocketConnection(acceptSocket, _memoryPool, _trace);
|
||||||
_ = connection.StartAsync(_handler);
|
_ = connection.StartAsync(_handler);
|
||||||
}
|
}
|
||||||
catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionReset)
|
catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionReset)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ namespace Microsoft.AspNetCore.Protocols
|
||||||
|
|
||||||
public abstract IPipeConnection Transport { get; set; }
|
public abstract IPipeConnection Transport { get; set; }
|
||||||
|
|
||||||
public abstract BufferPool BufferPool { get; }
|
public abstract MemoryPool MemoryPool { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Protocols
|
||||||
|
|
||||||
public override IFeatureCollection Features => _features.Collection;
|
public override IFeatureCollection Features => _features.Collection;
|
||||||
|
|
||||||
public override BufferPool BufferPool => ConnectionTransportFeature.BufferPool;
|
public override MemoryPool MemoryPool => ConnectionTransportFeature.MemoryPool;
|
||||||
|
|
||||||
public override IPipeConnection Transport
|
public override IPipeConnection Transport
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Protocols.Features
|
||||||
{
|
{
|
||||||
public interface IConnectionTransportFeature
|
public interface IConnectionTransportFeature
|
||||||
{
|
{
|
||||||
BufferPool BufferPool { get; }
|
MemoryPool MemoryPool { get; }
|
||||||
|
|
||||||
IPipeConnection Transport { get; set; }
|
IPipeConnection Transport { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ namespace System.IO.Pipelines
|
||||||
{
|
{
|
||||||
public static class PipeFactory
|
public static class PipeFactory
|
||||||
{
|
{
|
||||||
public static (IPipeConnection Transport, IPipeConnection Application) CreateConnectionPair(BufferPool memoryPool)
|
public static (IPipeConnection Transport, IPipeConnection Application) CreateConnectionPair(MemoryPool memoryPool)
|
||||||
{
|
{
|
||||||
return CreateConnectionPair(new PipeOptions(memoryPool), new PipeOptions(memoryPool));
|
return CreateConnectionPair(new PipeOptions(memoryPool), new PipeOptions(memoryPool));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
Set<IConnectionTransportFeature>(this);
|
Set<IConnectionTransportFeature>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferPool BufferPool { get; } = new MemoryPool();
|
public MemoryPool MemoryPool { get; } = new MemoryPool();
|
||||||
|
|
||||||
public IPipeConnection Transport { get; set; }
|
public IPipeConnection Transport { get; set; }
|
||||||
public IPipeConnection Application { get; set; }
|
public IPipeConnection Application { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
private readonly TestHttp1Connection _http1Connection;
|
private readonly TestHttp1Connection _http1Connection;
|
||||||
private readonly ServiceContext _serviceContext;
|
private readonly ServiceContext _serviceContext;
|
||||||
private readonly Http1ConnectionContext _http1ConnectionContext;
|
private readonly Http1ConnectionContext _http1ConnectionContext;
|
||||||
private readonly BufferPool _pipelineFactory;
|
private readonly MemoryPool _pipelineFactory;
|
||||||
private ReadCursor _consumed;
|
private ReadCursor _consumed;
|
||||||
private ReadCursor _examined;
|
private ReadCursor _examined;
|
||||||
private Mock<ITimeoutControl> _timeoutControl;
|
private Mock<ITimeoutControl> _timeoutControl;
|
||||||
|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
{
|
{
|
||||||
ServiceContext = _serviceContext,
|
ServiceContext = _serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = _pipelineFactory,
|
MemoryPool = _pipelineFactory,
|
||||||
TimeoutControl = _timeoutControl.Object,
|
TimeoutControl = _timeoutControl.Object,
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport
|
Transport = pair.Transport
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
private static readonly byte[] _noData = new byte[0];
|
private static readonly byte[] _noData = new byte[0];
|
||||||
private static readonly byte[] _maxData = Encoding.ASCII.GetBytes(new string('a', Http2Frame.MinAllowedMaxFrameSize));
|
private static readonly byte[] _maxData = Encoding.ASCII.GetBytes(new string('a', Http2Frame.MinAllowedMaxFrameSize));
|
||||||
|
|
||||||
private readonly BufferPool _bufferPool = new MemoryPool();
|
private readonly MemoryPool _memoryPool = new MemoryPool();
|
||||||
private readonly (IPipeConnection Transport, IPipeConnection Application) _pair;
|
private readonly (IPipeConnection Transport, IPipeConnection Application) _pair;
|
||||||
private readonly TestApplicationErrorLogger _logger;
|
private readonly TestApplicationErrorLogger _logger;
|
||||||
private readonly Http2ConnectionContext _connectionContext;
|
private readonly Http2ConnectionContext _connectionContext;
|
||||||
|
|
@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
|
|
||||||
public Http2ConnectionTests()
|
public Http2ConnectionTests()
|
||||||
{
|
{
|
||||||
_pair = PipeFactory.CreateConnectionPair(_bufferPool);
|
_pair = PipeFactory.CreateConnectionPair(_memoryPool);
|
||||||
|
|
||||||
_noopApplication = context => Task.CompletedTask;
|
_noopApplication = context => Task.CompletedTask;
|
||||||
|
|
||||||
|
|
@ -257,7 +257,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
{
|
{
|
||||||
Log = new TestKestrelTrace(_logger)
|
Log = new TestKestrelTrace(_logger)
|
||||||
},
|
},
|
||||||
BufferPool = _bufferPool,
|
MemoryPool = _memoryPool,
|
||||||
Application = _pair.Application,
|
Application = _pair.Application,
|
||||||
Transport = _pair.Transport
|
Transport = _pair.Transport
|
||||||
};
|
};
|
||||||
|
|
@ -266,7 +266,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_bufferPool.Dispose();
|
_memoryPool.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHttpHeadersHandler.OnHeader(Span<byte> name, Span<byte> value)
|
void IHttpHeadersHandler.OnHeader(Span<byte> name, Span<byte> value)
|
||||||
|
|
|
||||||
|
|
@ -18,21 +18,21 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
{
|
{
|
||||||
public class HttpConnectionTests : IDisposable
|
public class HttpConnectionTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly BufferPool _bufferPool;
|
private readonly MemoryPool _memoryPool;
|
||||||
private readonly HttpConnectionContext _httpConnectionContext;
|
private readonly HttpConnectionContext _httpConnectionContext;
|
||||||
private readonly HttpConnection _httpConnection;
|
private readonly HttpConnection _httpConnection;
|
||||||
|
|
||||||
public HttpConnectionTests()
|
public HttpConnectionTests()
|
||||||
{
|
{
|
||||||
_bufferPool = new MemoryPool();
|
_memoryPool = new MemoryPool();
|
||||||
var pair = PipeFactory.CreateConnectionPair(_bufferPool);
|
var pair = PipeFactory.CreateConnectionPair(_memoryPool);
|
||||||
|
|
||||||
_httpConnectionContext = new HttpConnectionContext
|
_httpConnectionContext = new HttpConnectionContext
|
||||||
{
|
{
|
||||||
ConnectionId = "0123456789",
|
ConnectionId = "0123456789",
|
||||||
ConnectionAdapters = new List<IConnectionAdapter>(),
|
ConnectionAdapters = new List<IConnectionAdapter>(),
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = _bufferPool,
|
MemoryPool = _memoryPool,
|
||||||
HttpConnectionId = long.MinValue,
|
HttpConnectionId = long.MinValue,
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport,
|
Transport = pair.Transport,
|
||||||
|
|
@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_bufferPool.Dispose();
|
_memoryPool.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
{
|
{
|
||||||
ServiceContext = new TestServiceContext(),
|
ServiceContext = new TestServiceContext(),
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = memoryPool,
|
MemoryPool = memoryPool,
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport,
|
Transport = pair.Transport,
|
||||||
TimeoutControl = null
|
TimeoutControl = null
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
{
|
{
|
||||||
public class OutputProducerTests : IDisposable
|
public class OutputProducerTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly BufferPool _bufferPool;
|
private readonly MemoryPool _memoryPool;
|
||||||
|
|
||||||
public OutputProducerTests()
|
public OutputProducerTests()
|
||||||
{
|
{
|
||||||
_bufferPool = new MemoryPool();
|
_memoryPool = new MemoryPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_bufferPool.Dispose();
|
_memoryPool.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
{
|
{
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool:_bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: Mock.Of<IScheduler>()
|
readerScheduler: Mock.Of<IScheduler>()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
private const int _ulongMaxValueLength = 20;
|
private const int _ulongMaxValueLength = 20;
|
||||||
|
|
||||||
private readonly IPipe _pipe;
|
private readonly IPipe _pipe;
|
||||||
private readonly BufferPool _bufferPool = new MemoryPool();
|
private readonly MemoryPool _memoryPool = new MemoryPool();
|
||||||
|
|
||||||
public PipelineExtensionTests()
|
public PipelineExtensionTests()
|
||||||
{
|
{
|
||||||
_pipe = new Pipe(new PipeOptions(_bufferPool));
|
_pipe = new Pipe(new PipeOptions(_memoryPool));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_bufferPool.Dispose();
|
_memoryPool.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
Application = Application,
|
Application = Application,
|
||||||
Transport = Transport,
|
Transport = Transport,
|
||||||
BufferPool = _memoryPool,
|
MemoryPool = _memoryPool,
|
||||||
TimeoutControl = Mock.Of<ITimeoutControl>()
|
TimeoutControl = Mock.Of<ITimeoutControl>()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
var thread = new LibuvThread(transport);
|
var thread = new LibuvThread(transport);
|
||||||
mockConnectionHandler.InputOptions = pool =>
|
mockConnectionHandler.InputOptions = pool =>
|
||||||
new PipeOptions(
|
new PipeOptions(
|
||||||
bufferPool: pool,
|
pool: pool,
|
||||||
maximumSizeHigh: 3);
|
maximumSizeHigh: 3);
|
||||||
|
|
||||||
// We don't set the output writer scheduler here since we want to run the callback inline
|
// We don't set the output writer scheduler here since we want to run the callback inline
|
||||||
|
|
||||||
mockConnectionHandler.OutputOptions = pool => new PipeOptions(bufferPool: pool, readerScheduler: thread);
|
mockConnectionHandler.OutputOptions = pool => new PipeOptions(pool: pool, readerScheduler: thread);
|
||||||
|
|
||||||
|
|
||||||
Task connectionTask = null;
|
Task connectionTask = null;
|
||||||
|
|
@ -125,12 +125,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
});
|
});
|
||||||
mockConnectionHandler.InputOptions = pool =>
|
mockConnectionHandler.InputOptions = pool =>
|
||||||
new PipeOptions(
|
new PipeOptions(
|
||||||
bufferPool: pool,
|
pool: pool,
|
||||||
maximumSizeHigh: 3,
|
maximumSizeHigh: 3,
|
||||||
maximumSizeLow: 3,
|
maximumSizeLow: 3,
|
||||||
writerScheduler: mockScheduler.Object);
|
writerScheduler: mockScheduler.Object);
|
||||||
|
|
||||||
mockConnectionHandler.OutputOptions = pool => new PipeOptions(bufferPool: pool, readerScheduler:thread );
|
mockConnectionHandler.OutputOptions = pool => new PipeOptions(pool: pool, readerScheduler:thread );
|
||||||
|
|
||||||
Task connectionTask = null;
|
Task connectionTask = null;
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
{
|
{
|
||||||
public class LibuvOutputConsumerTests : IDisposable
|
public class LibuvOutputConsumerTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly BufferPool _bufferPool;
|
private readonly MemoryPool _memoryPool;
|
||||||
private readonly MockLibuv _mockLibuv;
|
private readonly MockLibuv _mockLibuv;
|
||||||
private readonly LibuvThread _libuvThread;
|
private readonly LibuvThread _libuvThread;
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
public LibuvOutputConsumerTests()
|
public LibuvOutputConsumerTests()
|
||||||
{
|
{
|
||||||
_bufferPool = new MemoryPool();
|
_memoryPool = new MemoryPool();
|
||||||
_mockLibuv = new MockLibuv();
|
_mockLibuv = new MockLibuv();
|
||||||
|
|
||||||
var libuvTransport = new LibuvTransport(_mockLibuv, new TestLibuvTransportContext(), new ListenOptions((ulong)0));
|
var libuvTransport = new LibuvTransport(_mockLibuv, new TestLibuvTransportContext(), new ListenOptions((ulong)0));
|
||||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_libuvThread.StopAsync(TimeSpan.FromSeconds(1)).Wait();
|
_libuvThread.StopAsync(TimeSpan.FromSeconds(1)).Wait();
|
||||||
_bufferPool.Dispose();
|
_memoryPool.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize ?? 0,
|
maximumSizeHigh: maxResponseBufferSize ?? 0,
|
||||||
maximumSizeLow: maxResponseBufferSize ?? 0
|
maximumSizeLow: maxResponseBufferSize ?? 0
|
||||||
|
|
@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: 0,
|
maximumSizeHigh: 0,
|
||||||
maximumSizeLow: 0
|
maximumSizeLow: 0
|
||||||
|
|
@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: 1,
|
maximumSizeHigh: 1,
|
||||||
maximumSizeLow: 1
|
maximumSizeLow: 1
|
||||||
|
|
@ -204,7 +204,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize,
|
maximumSizeHigh: maxResponseBufferSize,
|
||||||
maximumSizeLow: maxResponseBufferSize
|
maximumSizeLow: maxResponseBufferSize
|
||||||
|
|
@ -268,7 +268,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize,
|
maximumSizeHigh: maxResponseBufferSize,
|
||||||
maximumSizeLow: maxResponseBufferSize
|
maximumSizeLow: maxResponseBufferSize
|
||||||
|
|
@ -338,7 +338,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize,
|
maximumSizeHigh: maxResponseBufferSize,
|
||||||
maximumSizeLow: maxResponseBufferSize
|
maximumSizeLow: maxResponseBufferSize
|
||||||
|
|
@ -431,7 +431,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize,
|
maximumSizeHigh: maxResponseBufferSize,
|
||||||
maximumSizeLow: maxResponseBufferSize
|
maximumSizeLow: maxResponseBufferSize
|
||||||
|
|
@ -515,7 +515,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize,
|
maximumSizeHigh: maxResponseBufferSize,
|
||||||
maximumSizeLow: maxResponseBufferSize
|
maximumSizeLow: maxResponseBufferSize
|
||||||
|
|
@ -597,7 +597,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
|
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize,
|
maximumSizeHigh: maxResponseBufferSize,
|
||||||
maximumSizeLow: maxResponseBufferSize
|
maximumSizeLow: maxResponseBufferSize
|
||||||
|
|
@ -658,7 +658,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
|
||||||
var pipeOptions = new PipeOptions
|
var pipeOptions = new PipeOptions
|
||||||
(
|
(
|
||||||
bufferPool: _bufferPool,
|
pool: _memoryPool,
|
||||||
readerScheduler: _libuvThread,
|
readerScheduler: _libuvThread,
|
||||||
maximumSizeHigh: maxResponseBufferSize ?? 0,
|
maximumSizeHigh: maxResponseBufferSize ?? 0,
|
||||||
maximumSizeLow: maxResponseBufferSize ?? 0
|
maximumSizeLow: maxResponseBufferSize ?? 0
|
||||||
|
|
@ -712,7 +712,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
||||||
{
|
{
|
||||||
ServiceContext = serviceContext,
|
ServiceContext = serviceContext,
|
||||||
ConnectionFeatures = new FeatureCollection(),
|
ConnectionFeatures = new FeatureCollection(),
|
||||||
BufferPool = _bufferPool,
|
MemoryPool = _memoryPool,
|
||||||
TimeoutControl = Mock.Of<ITimeoutControl>(),
|
TimeoutControl = Mock.Of<ITimeoutControl>(),
|
||||||
Application = pair.Application,
|
Application = pair.Application,
|
||||||
Transport = pair.Transport
|
Transport = pair.Transport
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.IO.Pipelines;
|
using System.IO.Pipelines;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
using Microsoft.AspNetCore.Protocols;
|
using Microsoft.AspNetCore.Protocols;
|
||||||
using Microsoft.AspNetCore.Protocols.Features;
|
using Microsoft.AspNetCore.Protocols.Features;
|
||||||
|
|
@ -14,15 +13,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.TestHelpers
|
||||||
{
|
{
|
||||||
public class MockConnectionHandler : IConnectionHandler
|
public class MockConnectionHandler : IConnectionHandler
|
||||||
{
|
{
|
||||||
public Func<BufferPool, PipeOptions> InputOptions { get; set; } = pool => new PipeOptions(pool);
|
public Func<MemoryPool, PipeOptions> InputOptions { get; set; } = pool => new PipeOptions(pool);
|
||||||
public Func<BufferPool, PipeOptions> OutputOptions { get; set; } = pool => new PipeOptions(pool);
|
public Func<MemoryPool, PipeOptions> OutputOptions { get; set; } = pool => new PipeOptions(pool);
|
||||||
|
|
||||||
public void OnConnection(IFeatureCollection features)
|
public void OnConnection(IFeatureCollection features)
|
||||||
{
|
{
|
||||||
var connectionContext = new DefaultConnectionContext(features);
|
var connectionContext = new DefaultConnectionContext(features);
|
||||||
|
|
||||||
Input = new Pipe(InputOptions(connectionContext.BufferPool));
|
Input = new Pipe(InputOptions(connectionContext.MemoryPool));
|
||||||
Output = new Pipe(OutputOptions(connectionContext.BufferPool));
|
Output = new Pipe(OutputOptions(connectionContext.MemoryPool));
|
||||||
|
|
||||||
var feature = connectionContext.Features.Get<IConnectionTransportFeature>();
|
var feature = connectionContext.Features.Get<IConnectionTransportFeature>();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue