Upgrade package references and react to corefx API changes (#2212)

This commit is contained in:
BrennanConroy 2017-12-11 09:02:37 -08:00 committed by GitHub
parent edebfc1bb9
commit 95dc8824c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 116 additions and 113 deletions

View File

@ -23,8 +23,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
[IterationSetup]
public void Setup()
{
var bufferPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(bufferPool);
var memoryPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(memoryPool);
var serviceContext = new ServiceContext
{
@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
{
ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = bufferPool,
MemoryPool = memoryPool,
TimeoutControl = new MockTimeoutControl(),
Application = pair.Application,
Transport = pair.Transport

View File

@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
{
ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = memoryPool,
MemoryPool = memoryPool,
Application = pair.Application,
Transport = pair.Transport
});

View File

@ -78,8 +78,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
public HttpProtocolFeatureCollection()
{
var bufferPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(bufferPool);
var memoryPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(memoryPool);
var serviceContext = new ServiceContext
{
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
{
ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = bufferPool,
MemoryPool = memoryPool,
Application = pair.Application,
Transport = pair.Transport
});

View File

@ -15,13 +15,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
private const int InnerLoopCount = 512;
private IPipe _pipe;
private BufferPool _bufferPool;
private MemoryPool _memoryPool;
[IterationSetup]
public void Setup()
{
_bufferPool = new MemoryPool();
_pipe = new Pipe(new PipeOptions(_bufferPool));
_memoryPool = new MemoryPool();
_pipe = new Pipe(new PipeOptions(_memoryPool));
}
[Benchmark(OperationsPerInvoke = InnerLoopCount)]

View File

@ -22,8 +22,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
[IterationSetup]
public void Setup()
{
var bufferPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(bufferPool);
var memoryPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(memoryPool);
var serviceContext = new ServiceContext
{
@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
{
ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = bufferPool,
MemoryPool = memoryPool,
Application = pair.Application,
Transport = pair.Transport,
TimeoutControl = new MockTimeoutControl()
@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
http1Connection.Reset();
Http1Connection = http1Connection;
Pipe = new Pipe(new PipeOptions(bufferPool));
Pipe = new Pipe(new PipeOptions(memoryPool));
}
[Benchmark(Baseline = true, OperationsPerInvoke = RequestParsingData.InnerLoopCount)]

View File

@ -171,8 +171,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
[IterationSetup]
public void Setup()
{
var bufferPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(bufferPool);
var memoryPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(memoryPool);
var serviceContext = new ServiceContext
{
@ -186,7 +186,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
{
ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = bufferPool,
MemoryPool = memoryPool,
Application = pair.Application,
Transport = pair.Transport
});

View File

@ -111,8 +111,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
[IterationSetup]
public void Setup()
{
var bufferPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(bufferPool);
var memoryPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(memoryPool);
var serviceContext = new ServiceContext
{
@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
{
ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = bufferPool,
MemoryPool = memoryPool,
TimeoutControl = new MockTimeoutControl(),
Application = pair.Application,
Transport = pair.Transport

View File

@ -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. -->
<PropertyGroup Label="Package Versions">
<BenchmarkDotNetPackageVersion>0.10.9</BenchmarkDotNetPackageVersion>
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15618</InternalAspNetCoreSdkPackageVersion>
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15620</InternalAspNetCoreSdkPackageVersion>
<LibuvPackageVersion>1.10.0</LibuvPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview1-27773</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
<MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>2.1.0-preview1-27773</MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>
@ -22,20 +22,20 @@
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview1-27773</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview1-27773</MicrosoftExtensionsOptionsPackageVersion>
<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>
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
<MoqPackageVersion>4.7.49</MoqPackageVersion>
<NewtonsoftJsonPackageVersion>10.0.1</NewtonsoftJsonPackageVersion>
<SystemBuffersPackageVersion>4.5.0-preview1-25914-04</SystemBuffersPackageVersion>
<SystemIOPipelinesPackageVersion>0.1.0-alpha-002</SystemIOPipelinesPackageVersion>
<SystemIOPipelinesTestingPackageVersion>0.1.0-alpha-002</SystemIOPipelinesTestingPackageVersion>
<SystemMemoryPackageVersion>4.5.0-preview1-25914-04</SystemMemoryPackageVersion>
<SystemNumericsVectorsPackageVersion>4.5.0-preview1-25914-04</SystemNumericsVectorsPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview1-25914-04</SystemRuntimeCompilerServicesUnsafePackageVersion>
<SystemSecurityCryptographyCngPackageVersion>4.5.0-preview1-25914-04</SystemSecurityCryptographyCngPackageVersion>
<SystemTextEncodingsWebUtf8PackageVersion>0.1.0-alpha-002</SystemTextEncodingsWebUtf8PackageVersion>
<SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview2-25707-02</SystemThreadingTasksExtensionsPackageVersion>
<SystemBuffersPackageVersion>4.5.0-preview1-26006-06</SystemBuffersPackageVersion>
<SystemIOPipelinesPackageVersion>0.1.0-e171206-2</SystemIOPipelinesPackageVersion>
<SystemIOPipelinesTestingPackageVersion>0.1.0-e171206-2</SystemIOPipelinesTestingPackageVersion>
<SystemMemoryPackageVersion>4.5.0-preview1-26006-06</SystemMemoryPackageVersion>
<SystemNumericsVectorsPackageVersion>4.5.0-preview1-26006-06</SystemNumericsVectorsPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview1-26006-06</SystemRuntimeCompilerServicesUnsafePackageVersion>
<SystemSecurityCryptographyCngPackageVersion>4.5.0-preview1-26006-06</SystemSecurityCryptographyCngPackageVersion>
<SystemTextEncodingsWebUtf8PackageVersion>0.1.0-e171206-2</SystemTextEncodingsWebUtf8PackageVersion>
<SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview1-26006-06</SystemThreadingTasksExtensionsPackageVersion>
<XunitAnalyzersPackageVersion>0.8.0</XunitAnalyzersPackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>

View File

@ -1,2 +1,2 @@
version:2.1.0-preview1-15618
commithash:00ce1383114015fe89b221146036e59e6bc11219
version:2.1.0-preview1-15620
commithash:6432b49a2c00310416df39b6fe548ef4af9c6011

View File

@ -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
// for the scheduler and limits are specified here
var inputOptions = GetInputPipeOptions(_serviceContext, connectionContext.BufferPool, transportFeature.InputWriterScheduler);
var outputOptions = GetOutputPipeOptions(_serviceContext, connectionContext.BufferPool, transportFeature.OutputReaderScheduler);
var inputOptions = GetInputPipeOptions(_serviceContext, connectionContext.MemoryPool, transportFeature.InputWriterScheduler);
var outputOptions = GetOutputPipeOptions(_serviceContext, connectionContext.MemoryPool, transportFeature.OutputReaderScheduler);
var pair = PipeFactory.CreateConnectionPair(inputOptions, outputOptions);
@ -83,18 +83,18 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
}
// 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,
writerScheduler: writerScheduler,
maximumSizeHigh: 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,
writerScheduler: serviceContext.ThreadPool,
maximumSizeHigh: GetOutputResponseBufferSize(serviceContext),

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
public string ConnectionId { get; set; }
public ServiceContext ServiceContext { get; set; }
public IFeatureCollection ConnectionFeatures { get; set; }
public BufferPool BufferPool { get; set; }
public MemoryPool MemoryPool { get; set; }
public IPEndPoint RemoteEndPoint { get; set; }
public IPEndPoint LocalEndPoint { get; set; }
public ITimeoutControl TimeoutControl { get; set; }

View File

@ -1300,7 +1300,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
private Pipe CreateRequestBodyPipe()
=> new Pipe(new PipeOptions
(
bufferPool: _context.BufferPool,
pool: _context.MemoryPool,
readerScheduler: ServiceContext.ThreadPool,
writerScheduler: InlineScheduler.Default,
maximumSizeHigh: 1,

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
string ConnectionId { get; set; }
ServiceContext ServiceContext { get; set; }
IFeatureCollection ConnectionFeatures { get; set; }
BufferPool BufferPool { get; set; }
MemoryPool MemoryPool { get; set; }
IPEndPoint RemoteEndPoint { get; set; }
IPEndPoint LocalEndPoint { get; set; }
}

View File

@ -398,7 +398,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
StreamId = _incomingFrame.StreamId,
ServiceContext = _context.ServiceContext,
ConnectionFeatures = _context.ConnectionFeatures,
BufferPool = _context.BufferPool,
MemoryPool = _context.MemoryPool,
LocalEndPoint = _context.LocalEndPoint,
RemoteEndPoint = _context.RemoteEndPoint,
StreamLifetimeHandler = this,

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
public string ConnectionId { get; set; }
public ServiceContext ServiceContext { get; set; }
public IFeatureCollection ConnectionFeatures { get; set; }
public BufferPool BufferPool { get; set; }
public MemoryPool MemoryPool { get; set; }
public IPEndPoint LocalEndPoint { get; set; }
public IPEndPoint RemoteEndPoint { get; set; }

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
public int StreamId { get; set; }
public ServiceContext ServiceContext { get; set; }
public IFeatureCollection ConnectionFeatures { get; set; }
public BufferPool BufferPool { get; set; }
public MemoryPool MemoryPool { get; set; }
public IPEndPoint RemoteEndPoint { get; set; }
public IPEndPoint LocalEndPoint { get; set; }
public IHttp2StreamLifetimeHandler StreamLifetimeHandler { get; set; }

View File

@ -66,12 +66,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
public IPEndPoint LocalEndPoint => _context.LocalEndPoint;
public IPEndPoint RemoteEndPoint => _context.RemoteEndPoint;
private BufferPool BufferPool => _context.BufferPool;
private MemoryPool MemoryPool => _context.MemoryPool;
// Internal for testing
internal PipeOptions AdaptedInputPipeOptions => new PipeOptions
(
bufferPool: BufferPool,
pool: MemoryPool,
readerScheduler: _context.ServiceContext.ThreadPool,
writerScheduler: InlineScheduler.Default,
maximumSizeHigh: _context.ServiceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0,
@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
internal PipeOptions AdaptedOutputPipeOptions => new PipeOptions
(
bufferPool: BufferPool,
pool: MemoryPool,
readerScheduler: InlineScheduler.Default,
writerScheduler: InlineScheduler.Default,
maximumSizeHigh: _context.ServiceContext.ServerOptions.Limits.MaxResponseBufferSize ?? 0,
@ -203,7 +203,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
{
ConnectionId = _context.ConnectionId,
ConnectionFeatures = _context.ConnectionFeatures,
BufferPool = BufferPool,
MemoryPool = MemoryPool,
LocalEndPoint = LocalEndPoint,
RemoteEndPoint = RemoteEndPoint,
ServiceContext = _context.ServiceContext,
@ -220,7 +220,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
ConnectionId = _context.ConnectionId,
ServiceContext = _context.ServiceContext,
ConnectionFeatures = _context.ConnectionFeatures,
BufferPool = BufferPool,
MemoryPool = MemoryPool,
LocalEndPoint = LocalEndPoint,
RemoteEndPoint = RemoteEndPoint,
Application = application,

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
public ServiceContext ServiceContext { get; set; }
public IFeatureCollection ConnectionFeatures { 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 RemoteEndPoint { get; set; }
public IPipeConnection Transport { get; set; }

View File

@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
Protocols = _protocols,
ServiceContext = _serviceContext,
ConnectionFeatures = connectionContext.Features,
BufferPool = connectionContext.BufferPool,
MemoryPool = connectionContext.MemoryPool,
ConnectionAdapters = _connectionAdapters,
Transport = connectionContext.Transport,
Application = transportFeature.Application

View File

@ -96,7 +96,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal
set => LocalPort = value;
}
BufferPool IConnectionTransportFeature.BufferPool => BufferPool;
MemoryPool IConnectionTransportFeature.MemoryPool => MemoryPool;
IPipeConnection IConnectionTransportFeature.Transport
{

View File

@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal
public string ConnectionId { get; set; }
public virtual BufferPool BufferPool { get; }
public virtual MemoryPool MemoryPool { get; }
public virtual IScheduler InputWriterScheduler { get; }
public virtual IScheduler OutputReaderScheduler { get; }

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
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 OutputReaderScheduler => ListenerContext.Thread;
}

View File

@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
#endif
QueueCloseHandle = PostCloseHandle;
QueueCloseAsyncHandle = EnqueueCloseHandle;
BufferPool = new MemoryPool();
MemoryPool = new MemoryPool();
WriteReqPool = new WriteReqPool(this, _log);
}
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
public UvLoopHandle Loop { get { return _loop; } }
public BufferPool BufferPool { get; }
public MemoryPool MemoryPool { get; }
public WriteReqPool WriteReqPool { get; }
@ -296,7 +296,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
}
finally
{
BufferPool.Dispose();
MemoryPool.Dispose();
WriteReqPool.Dispose();
_threadTcs.SetResult(null);

View File

@ -28,14 +28,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
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(bufferPool != null);
Debug.Assert(memoryPool != null);
Debug.Assert(trace != null);
_socket = socket;
BufferPool = bufferPool;
MemoryPool = memoryPool;
_trace = trace;
var localEndPoint = (IPEndPoint)_socket.LocalEndPoint;
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
_sender = new SocketSender(_socket);
}
public override BufferPool BufferPool { get; }
public override MemoryPool MemoryPool { get; }
public override IScheduler InputWriterScheduler => InlineScheduler.Default;
public override IScheduler OutputReaderScheduler => TaskRunScheduler.Default;

View File

@ -31,7 +31,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
return SendAsync(buffers.First);
}
#if NETCOREAPP2_1
if (!_eventArgs.MemoryBuffer.Equals(Memory<byte>.Empty))
#else
if (_eventArgs.Buffer != null)
#endif
{
_eventArgs.SetBuffer(null, 0, 0);
}

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
{
internal sealed class SocketTransport : ITransport
{
private readonly BufferPool _bufferPool = new MemoryPool();
private readonly MemoryPool _memoryPool = new MemoryPool();
private readonly IEndPointInformation _endPointInformation;
private readonly IConnectionHandler _handler;
private readonly IApplicationLifetime _appLifetime;
@ -116,7 +116,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
public Task StopAsync()
{
_bufferPool.Dispose();
_memoryPool.Dispose();
return Task.CompletedTask;
}
@ -131,7 +131,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
var acceptSocket = await _listenSocket.AcceptAsync();
acceptSocket.NoDelay = _endPointInformation.NoDelay;
var connection = new SocketConnection(acceptSocket, _bufferPool, _trace);
var connection = new SocketConnection(acceptSocket, _memoryPool, _trace);
_ = connection.StartAsync(_handler);
}
catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionReset)

View File

@ -15,6 +15,6 @@ namespace Microsoft.AspNetCore.Protocols
public abstract IPipeConnection Transport { get; set; }
public abstract BufferPool BufferPool { get; }
public abstract MemoryPool MemoryPool { get; }
}
}

View File

@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Protocols
public override IFeatureCollection Features => _features.Collection;
public override BufferPool BufferPool => ConnectionTransportFeature.BufferPool;
public override MemoryPool MemoryPool => ConnectionTransportFeature.MemoryPool;
public override IPipeConnection Transport
{

View File

@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Protocols.Features
{
public interface IConnectionTransportFeature
{
BufferPool BufferPool { get; }
MemoryPool MemoryPool { get; }
IPipeConnection Transport { get; set; }

View File

@ -4,7 +4,7 @@ namespace System.IO.Pipelines
{
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));
}

View File

@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
Set<IConnectionTransportFeature>(this);
}
public BufferPool BufferPool { get; } = new MemoryPool();
public MemoryPool MemoryPool { get; } = new MemoryPool();
public IPipeConnection Transport { get; set; }
public IPipeConnection Application { get; set; }

View File

@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
private readonly TestHttp1Connection _http1Connection;
private readonly ServiceContext _serviceContext;
private readonly Http1ConnectionContext _http1ConnectionContext;
private readonly BufferPool _pipelineFactory;
private readonly MemoryPool _pipelineFactory;
private ReadCursor _consumed;
private ReadCursor _examined;
private Mock<ITimeoutControl> _timeoutControl;
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{
ServiceContext = _serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = _pipelineFactory,
MemoryPool = _pipelineFactory,
TimeoutControl = _timeoutControl.Object,
Application = pair.Application,
Transport = pair.Transport

View File

@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
private static readonly byte[] _noData = new byte[0];
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 TestApplicationErrorLogger _logger;
private readonly Http2ConnectionContext _connectionContext;
@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
public Http2ConnectionTests()
{
_pair = PipeFactory.CreateConnectionPair(_bufferPool);
_pair = PipeFactory.CreateConnectionPair(_memoryPool);
_noopApplication = context => Task.CompletedTask;
@ -257,7 +257,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{
Log = new TestKestrelTrace(_logger)
},
BufferPool = _bufferPool,
MemoryPool = _memoryPool,
Application = _pair.Application,
Transport = _pair.Transport
};
@ -266,7 +266,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
public void Dispose()
{
_bufferPool.Dispose();
_memoryPool.Dispose();
}
void IHttpHeadersHandler.OnHeader(Span<byte> name, Span<byte> value)

View File

@ -18,21 +18,21 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{
public class HttpConnectionTests : IDisposable
{
private readonly BufferPool _bufferPool;
private readonly MemoryPool _memoryPool;
private readonly HttpConnectionContext _httpConnectionContext;
private readonly HttpConnection _httpConnection;
public HttpConnectionTests()
{
_bufferPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(_bufferPool);
_memoryPool = new MemoryPool();
var pair = PipeFactory.CreateConnectionPair(_memoryPool);
_httpConnectionContext = new HttpConnectionContext
{
ConnectionId = "0123456789",
ConnectionAdapters = new List<IConnectionAdapter>(),
ConnectionFeatures = new FeatureCollection(),
BufferPool = _bufferPool,
MemoryPool = _memoryPool,
HttpConnectionId = long.MinValue,
Application = pair.Application,
Transport = pair.Transport,
@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
public void Dispose()
{
_bufferPool.Dispose();
_memoryPool.Dispose();
}
[Fact]

View File

@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{
ServiceContext = new TestServiceContext(),
ConnectionFeatures = new FeatureCollection(),
BufferPool = memoryPool,
MemoryPool = memoryPool,
Application = pair.Application,
Transport = pair.Transport,
TimeoutControl = null

View File

@ -15,16 +15,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{
public class OutputProducerTests : IDisposable
{
private readonly BufferPool _bufferPool;
private readonly MemoryPool _memoryPool;
public OutputProducerTests()
{
_bufferPool = new MemoryPool();
_memoryPool = new MemoryPool();
}
public void Dispose()
{
_bufferPool.Dispose();
_memoryPool.Dispose();
}
[Fact]
@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
{
var pipeOptions = new PipeOptions
(
bufferPool:_bufferPool,
pool: _memoryPool,
readerScheduler: Mock.Of<IScheduler>()
);

View File

@ -16,16 +16,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
private const int _ulongMaxValueLength = 20;
private readonly IPipe _pipe;
private readonly BufferPool _bufferPool = new MemoryPool();
private readonly MemoryPool _memoryPool = new MemoryPool();
public PipelineExtensionTests()
{
_pipe = new Pipe(new PipeOptions(_bufferPool));
_pipe = new Pipe(new PipeOptions(_memoryPool));
}
public void Dispose()
{
_bufferPool.Dispose();
_memoryPool.Dispose();
}
[Theory]

View File

@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
ConnectionFeatures = new FeatureCollection(),
Application = Application,
Transport = Transport,
BufferPool = _memoryPool,
MemoryPool = _memoryPool,
TimeoutControl = Mock.Of<ITimeoutControl>()
};

View File

@ -61,12 +61,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
var thread = new LibuvThread(transport);
mockConnectionHandler.InputOptions = pool =>
new PipeOptions(
bufferPool: pool,
pool: pool,
maximumSizeHigh: 3);
// 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;
@ -125,12 +125,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
});
mockConnectionHandler.InputOptions = pool =>
new PipeOptions(
bufferPool: pool,
pool: pool,
maximumSizeHigh: 3,
maximumSizeLow: 3,
writerScheduler: mockScheduler.Object);
mockConnectionHandler.OutputOptions = pool => new PipeOptions(bufferPool: pool, readerScheduler:thread );
mockConnectionHandler.OutputOptions = pool => new PipeOptions(pool: pool, readerScheduler:thread );
Task connectionTask = null;
try

View File

@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
{
public class LibuvOutputConsumerTests : IDisposable
{
private readonly BufferPool _bufferPool;
private readonly MemoryPool _memoryPool;
private readonly MockLibuv _mockLibuv;
private readonly LibuvThread _libuvThread;
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
public LibuvOutputConsumerTests()
{
_bufferPool = new MemoryPool();
_memoryPool = new MemoryPool();
_mockLibuv = new MockLibuv();
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()
{
_libuvThread.StopAsync(TimeSpan.FromSeconds(1)).Wait();
_bufferPool.Dispose();
_memoryPool.Dispose();
}
[Theory]
@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize ?? 0,
maximumSizeLow: maxResponseBufferSize ?? 0
@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: 0,
maximumSizeLow: 0
@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: 1,
maximumSizeLow: 1
@ -204,7 +204,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize,
maximumSizeLow: maxResponseBufferSize
@ -268,7 +268,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize,
maximumSizeLow: maxResponseBufferSize
@ -338,7 +338,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize,
maximumSizeLow: maxResponseBufferSize
@ -431,7 +431,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize,
maximumSizeLow: maxResponseBufferSize
@ -515,7 +515,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize,
maximumSizeLow: maxResponseBufferSize
@ -597,7 +597,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize,
maximumSizeLow: maxResponseBufferSize
@ -658,7 +658,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
// This is verified in PipeOptionsTests.OutputPipeOptionsConfiguredCorrectly.
var pipeOptions = new PipeOptions
(
bufferPool: _bufferPool,
pool: _memoryPool,
readerScheduler: _libuvThread,
maximumSizeHigh: maxResponseBufferSize ?? 0,
maximumSizeLow: maxResponseBufferSize ?? 0
@ -712,7 +712,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
{
ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(),
BufferPool = _bufferPool,
MemoryPool = _memoryPool,
TimeoutControl = Mock.Of<ITimeoutControl>(),
Application = pair.Application,
Transport = pair.Transport

View File

@ -4,7 +4,6 @@
using System;
using System.Buffers;
using System.IO.Pipelines;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Protocols.Features;
@ -14,15 +13,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.TestHelpers
{
public class MockConnectionHandler : IConnectionHandler
{
public Func<BufferPool, PipeOptions> InputOptions { get; set; } = pool => new PipeOptions(pool);
public Func<BufferPool, PipeOptions> OutputOptions { get; set; } = pool => new PipeOptions(pool);
public Func<MemoryPool, PipeOptions> InputOptions { get; set; } = pool => new PipeOptions(pool);
public Func<MemoryPool, PipeOptions> OutputOptions { get; set; } = pool => new PipeOptions(pool);
public void OnConnection(IFeatureCollection features)
{
var connectionContext = new DefaultConnectionContext(features);
Input = new Pipe(InputOptions(connectionContext.BufferPool));
Output = new Pipe(OutputOptions(connectionContext.BufferPool));
Input = new Pipe(InputOptions(connectionContext.MemoryPool));
Output = new Pipe(OutputOptions(connectionContext.MemoryPool));
var feature = connectionContext.Features.Get<IConnectionTransportFeature>();