Clean up some remants of the past (#2827)

- Remove Application from HttpConnectionContext and Http*ConnectionContext (it's no longer required)
This commit is contained in:
David Fowler 2018-08-15 23:41:32 -07:00 committed by GitHub
parent 5becb72107
commit 83488886e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 46 additions and 59 deletions

View File

@ -43,7 +43,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
MemoryPool = memoryPool, MemoryPool = memoryPool,
TimeoutControl = new MockTimeoutControl(), TimeoutControl = new MockTimeoutControl(),
Application = pair.Application,
Transport = pair.Transport Transport = pair.Transport
}); });

View File

@ -39,7 +39,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
MemoryPool = memoryPool, MemoryPool = memoryPool,
TimeoutControl = new MockTimeoutControl(), TimeoutControl = new MockTimeoutControl(),
Application = pair.Application,
Transport = pair.Transport Transport = pair.Transport
}); });

View File

@ -113,7 +113,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
ServiceContext = serviceContext, ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
Application = pair.Application,
Transport = pair.Transport Transport = pair.Transport
}); });

View File

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

View File

@ -41,7 +41,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
ServiceContext = serviceContext, ServiceContext = serviceContext,
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
Application = pair.Application,
Transport = pair.Transport, Transport = pair.Transport,
TimeoutControl = new MockTimeoutControl() TimeoutControl = new MockTimeoutControl()
}); });

View File

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

View File

@ -133,7 +133,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
TimeoutControl = new MockTimeoutControl(), TimeoutControl = new MockTimeoutControl(),
Application = _pair.Application,
Transport = _pair.Transport Transport = _pair.Transport
}); });

View File

@ -3,6 +3,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Threading;
using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
@ -22,7 +23,7 @@ namespace Microsoft.AspNetCore.Connections
{ {
// We expect this to be overridden, but this helps maintain back compat // We expect this to be overridden, but this helps maintain back compat
// with implementations of ConnectionContext that predate the addition of // with implementations of ConnectionContext that predate the addition of
// ConnectioContext.Abort() // ConnectionContext.Abort()
Features.Get<IConnectionLifetimeFeature>()?.Abort(); Features.Get<IConnectionLifetimeFeature>()?.Abort();
} }

View File

@ -168,9 +168,5 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
_transport.Input.Complete(); _transport.Input.Complete();
} }
} }
public void Dispose()
{
}
} }
} }

View File

@ -21,6 +21,5 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
public IPEndPoint LocalEndPoint { get; set; } public IPEndPoint LocalEndPoint { get; set; }
public ITimeoutControl TimeoutControl { get; set; } public ITimeoutControl TimeoutControl { get; set; }
public IDuplexPipe Transport { get; set; } public IDuplexPipe Transport { get; set; }
public IDuplexPipe Application { get; set; }
} }
} }

View File

@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
public Http2Connection(Http2ConnectionContext context) public Http2Connection(Http2ConnectionContext context)
{ {
_context = context; _context = context;
_frameWriter = new Http2FrameWriter(context.Transport.Output, context.Application.Input, _outputFlowControl, this, context.ConnectionId, context.ServiceContext.Log); _frameWriter = new Http2FrameWriter(context.Transport.Output, context.ConnectionContext, _outputFlowControl, this, context.ConnectionId, context.ServiceContext.Log);
_hpackDecoder = new HPackDecoder((int)_serverSettings.HeaderTableSize); _hpackDecoder = new HPackDecoder((int)_serverSettings.HeaderTableSize);
_serverSettings.MaxConcurrentStreams = (uint)context.ServiceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection; _serverSettings.MaxConcurrentStreams = (uint)context.ServiceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection;
} }

View File

@ -4,6 +4,7 @@
using System.Buffers; using System.Buffers;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Net; using System.Net;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
@ -11,13 +12,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
public class Http2ConnectionContext public class Http2ConnectionContext
{ {
public string ConnectionId { get; set; } public string ConnectionId { get; set; }
public ConnectionContext ConnectionContext { get; set; }
public ServiceContext ServiceContext { get; set; } public ServiceContext ServiceContext { get; set; }
public IFeatureCollection ConnectionFeatures { get; set; } public IFeatureCollection ConnectionFeatures { get; set; }
public MemoryPool<byte> MemoryPool { get; set; } public MemoryPool<byte> MemoryPool { get; set; }
public IPEndPoint LocalEndPoint { get; set; } public IPEndPoint LocalEndPoint { get; set; }
public IPEndPoint RemoteEndPoint { get; set; } public IPEndPoint RemoteEndPoint { get; set; }
public IDuplexPipe Transport { get; set; } public IDuplexPipe Transport { get; set; }
public IDuplexPipe Application { get; set; }
} }
} }

View File

@ -26,7 +26,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
private readonly object _writeLock = new object(); private readonly object _writeLock = new object();
private readonly HPackEncoder _hpackEncoder = new HPackEncoder(); private readonly HPackEncoder _hpackEncoder = new HPackEncoder();
private readonly PipeWriter _outputWriter; private readonly PipeWriter _outputWriter;
private readonly PipeReader _outputReader; private bool _aborted;
private readonly ConnectionContext _connectionContext;
private readonly OutputFlowControl _connectionOutputFlowControl; private readonly OutputFlowControl _connectionOutputFlowControl;
private readonly string _connectionId; private readonly string _connectionId;
private readonly IKestrelTrace _log; private readonly IKestrelTrace _log;
@ -36,15 +37,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
public Http2FrameWriter( public Http2FrameWriter(
PipeWriter outputPipeWriter, PipeWriter outputPipeWriter,
PipeReader outputPipeReader, ConnectionContext connectionContext,
OutputFlowControl connectionOutputFlowControl, OutputFlowControl connectionOutputFlowControl,
ITimeoutControl timeoutControl, ITimeoutControl timeoutControl,
string connectionId, string connectionId,
IKestrelTrace log) IKestrelTrace log)
{ {
_outputWriter = outputPipeWriter; _outputWriter = outputPipeWriter;
_outputReader = outputPipeReader; _connectionContext = connectionContext;
_connectionOutputFlowControl = connectionOutputFlowControl; _connectionOutputFlowControl = connectionOutputFlowControl;
_connectionId = connectionId; _connectionId = connectionId;
_log = log; _log = log;
@ -66,11 +66,20 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
} }
} }
public void Abort(ConnectionAbortedException ex) public void Abort(ConnectionAbortedException error)
{ {
// TODO: Really abort the connection using the ConnectionContex like Http1OutputProducer. lock (_writeLock)
_outputReader.CancelPendingRead(); {
Complete(); if (_aborted)
{
return;
}
_aborted = true;
_connectionContext.Abort(error);
Complete();
}
} }
public Task FlushAsync(IHttpOutputProducer outputProducer, CancellationToken cancellationToken) public Task FlushAsync(IHttpOutputProducer outputProducer, CancellationToken cancellationToken)
@ -239,7 +248,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
} }
// This awaitable releases continuations in FIFO order when the window updates. // This awaitable releases continuations in FIFO order when the window updates.
// It should be very rare for a continuation to run without any availability. // It should be very rare for a continuation to run without any availability.
if (availabilityAwaitable != null) if (availabilityAwaitable != null)
{ {
await availabilityAwaitable; await availabilityAwaitable;

View File

@ -112,7 +112,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
// _adaptedTransport must be set prior to adding the connection to the manager in order // _adaptedTransport must be set prior to adding the connection to the manager in order
// to allow the connection to be aported prior to protocol selection. // to allow the connection to be aported prior to protocol selection.
_adaptedTransport = _context.Transport; _adaptedTransport = _context.Transport;
var application = _context.Application;
if (_context.ConnectionAdapters.Count > 0) if (_context.ConnectionAdapters.Count > 0)
@ -147,14 +146,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
{ {
case HttpProtocols.Http1: case HttpProtocols.Http1:
// _http1Connection must be initialized before adding the connection to the connection manager // _http1Connection must be initialized before adding the connection to the connection manager
requestProcessor = _http1Connection = CreateHttp1Connection(_adaptedTransport, application); requestProcessor = _http1Connection = CreateHttp1Connection(_adaptedTransport);
_protocolSelectionState = ProtocolSelectionState.Selected; _protocolSelectionState = ProtocolSelectionState.Selected;
break; break;
case HttpProtocols.Http2: case HttpProtocols.Http2:
// _http2Connection must be initialized before yielding control to the transport thread, // _http2Connection must be initialized before yielding control to the transport thread,
// to prevent a race condition where _http2Connection.Abort() is called just as // to prevent a race condition where _http2Connection.Abort() is called just as
// _http2Connection is about to be initialized. // _http2Connection is about to be initialized.
requestProcessor = CreateHttp2Connection(_adaptedTransport, application); requestProcessor = CreateHttp2Connection(_adaptedTransport);
_protocolSelectionState = ProtocolSelectionState.Selected; _protocolSelectionState = ProtocolSelectionState.Selected;
break; break;
case HttpProtocols.None: case HttpProtocols.None:
@ -199,13 +198,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
} }
// For testing only // For testing only
internal void Initialize(IDuplexPipe transport, IDuplexPipe application) internal void Initialize(IDuplexPipe transport)
{ {
_requestProcessor = _http1Connection = CreateHttp1Connection(transport, application); _requestProcessor = _http1Connection = CreateHttp1Connection(transport);
_protocolSelectionState = ProtocolSelectionState.Selected; _protocolSelectionState = ProtocolSelectionState.Selected;
} }
private Http1Connection CreateHttp1Connection(IDuplexPipe transport, IDuplexPipe application) private Http1Connection CreateHttp1Connection(IDuplexPipe transport)
{ {
return new Http1Connection(new Http1ConnectionContext return new Http1Connection(new Http1ConnectionContext
{ {
@ -217,22 +216,21 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
ServiceContext = _context.ServiceContext, ServiceContext = _context.ServiceContext,
ConnectionContext = _context.ConnectionContext, ConnectionContext = _context.ConnectionContext,
TimeoutControl = this, TimeoutControl = this,
Transport = transport, Transport = transport
Application = application
}); });
} }
private Http2Connection CreateHttp2Connection(IDuplexPipe transport, IDuplexPipe application) private Http2Connection CreateHttp2Connection(IDuplexPipe transport)
{ {
return new Http2Connection(new Http2ConnectionContext return new Http2Connection(new Http2ConnectionContext
{ {
ConnectionId = _context.ConnectionId, ConnectionId = _context.ConnectionId,
ConnectionContext = _context.ConnectionContext,
ServiceContext = _context.ServiceContext, ServiceContext = _context.ServiceContext,
ConnectionFeatures = _context.ConnectionFeatures, ConnectionFeatures = _context.ConnectionFeatures,
MemoryPool = MemoryPool, MemoryPool = MemoryPool,
LocalEndPoint = LocalEndPoint, LocalEndPoint = LocalEndPoint,
RemoteEndPoint = RemoteEndPoint, RemoteEndPoint = RemoteEndPoint,
Application = application,
Transport = transport Transport = transport
}); });
} }

View File

@ -24,6 +24,5 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
public IPEndPoint LocalEndPoint { get; set; } public IPEndPoint LocalEndPoint { get; set; }
public IPEndPoint RemoteEndPoint { get; set; } public IPEndPoint RemoteEndPoint { get; set; }
public IDuplexPipe Transport { get; set; } public IDuplexPipe Transport { get; set; }
public IDuplexPipe Application { get; set; }
} }
} }

View File

@ -37,7 +37,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
{ {
// We need the transport feature so that we can cancel the output reader that the transport is using // We need the transport feature so that we can cancel the output reader that the transport is using
// This is a bit of a hack but it preserves the existing semantics // This is a bit of a hack but it preserves the existing semantics
var applicationFeature = connectionContext.Features.Get<IApplicationTransportFeature>();
var memoryPoolFeature = connectionContext.Features.Get<IMemoryPoolFeature>(); var memoryPoolFeature = connectionContext.Features.Get<IMemoryPoolFeature>();
var httpConnectionId = Interlocked.Increment(ref _lastHttpConnectionId); var httpConnectionId = Interlocked.Increment(ref _lastHttpConnectionId);
@ -52,8 +51,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
ConnectionFeatures = connectionContext.Features, ConnectionFeatures = connectionContext.Features,
MemoryPool = memoryPoolFeature.MemoryPool, MemoryPool = memoryPoolFeature.MemoryPool,
ConnectionAdapters = _connectionAdapters, ConnectionAdapters = _connectionAdapters,
Transport = connectionContext.Transport, Transport = connectionContext.Transport
Application = applicationFeature.Application
}; };
var connectionFeature = connectionContext.Features.Get<IHttpConnectionFeature>(); var connectionFeature = connectionContext.Features.Get<IHttpConnectionFeature>();

View File

@ -63,7 +63,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
ConnectionFeatures = connectionFeatures, ConnectionFeatures = connectionFeatures,
MemoryPool = _pipelineFactory, MemoryPool = _pipelineFactory,
TimeoutControl = _timeoutControl.Object, TimeoutControl = _timeoutControl.Object,
Application = pair.Application,
Transport = pair.Transport Transport = pair.Transport
}; };

View File

@ -44,7 +44,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
ConnectionFeatures = connectionFeatures, ConnectionFeatures = connectionFeatures,
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
HttpConnectionId = long.MinValue, HttpConnectionId = long.MinValue,
Application = pair.Application,
Transport = pair.Transport, Transport = pair.Transport,
ServiceContext = new TestServiceContext ServiceContext = new TestServiceContext
{ {
@ -66,7 +65,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockDebugger = new Mock<IDebugger>(); var mockDebugger = new Mock<IDebugger>();
mockDebugger.SetupGet(g => g.IsAttached).Returns(true); mockDebugger.SetupGet(g => g.IsAttached).Returns(true);
_httpConnection.Debugger = mockDebugger.Object; _httpConnection.Debugger = mockDebugger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
var now = DateTimeOffset.Now; var now = DateTimeOffset.Now;
_httpConnection.Tick(now); _httpConnection.Tick(now);
@ -113,7 +112,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
_httpConnectionContext.ServiceContext.Log = logger; _httpConnectionContext.ServiceContext.Log = logger;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
// Initialize timestamp // Initialize timestamp
@ -140,7 +139,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
// Initialize timestamp // Initialize timestamp
@ -182,7 +181,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
// Initialize timestamp // Initialize timestamp
@ -259,7 +258,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
// Initialize timestamp // Initialize timestamp
@ -327,7 +326,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
// Initialize timestamp // Initialize timestamp
@ -389,7 +388,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
var startTime = systemClock.UtcNow; var startTime = systemClock.UtcNow;
@ -430,7 +429,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
_httpConnection.Http1Connection.RequestAborted.Register(() => _httpConnection.Http1Connection.RequestAborted.Register(() =>
{ {
@ -464,7 +463,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
_httpConnection.Http1Connection.RequestAborted.Register(() => _httpConnection.Http1Connection.RequestAborted.Register(() =>
{ {
@ -506,7 +505,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
_httpConnection.Http1Connection.RequestAborted.Register(() => _httpConnection.Http1Connection.RequestAborted.Register(() =>
{ {
@ -555,7 +554,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var mockLogger = new Mock<IKestrelTrace>(); var mockLogger = new Mock<IKestrelTrace>();
_httpConnectionContext.ServiceContext.Log = mockLogger.Object; _httpConnectionContext.ServiceContext.Log = mockLogger.Object;
_httpConnection.Initialize(_httpConnectionContext.Transport, _httpConnectionContext.Application); _httpConnection.Initialize(_httpConnectionContext.Transport);
_httpConnection.Http1Connection.Reset(); _httpConnection.Http1Connection.Reset();
_httpConnection.Http1Connection.RequestAborted.Register(() => _httpConnection.Http1Connection.RequestAborted.Register(() =>
{ {

View File

@ -46,7 +46,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
TimeoutControl = _timeoutControl.Object, TimeoutControl = _timeoutControl.Object,
Application = pair.Application,
Transport = pair.Transport Transport = pair.Transport
}; };

View File

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

View File

@ -422,12 +422,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
var options = new PipeOptions(pool: memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var options = new PipeOptions(pool: memoryPool, readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false);
var pair = DuplexPipe.CreateConnectionPair(options, options); var pair = DuplexPipe.CreateConnectionPair(options, options);
var transport = pair.Transport; var transport = pair.Transport;
var application = pair.Application;
var http1ConnectionContext = new Http1ConnectionContext var http1ConnectionContext = new Http1ConnectionContext
{ {
ServiceContext = new TestServiceContext(), ServiceContext = new TestServiceContext(),
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
Application = application,
Transport = transport, Transport = transport,
MemoryPool = memoryPool, MemoryPool = memoryPool,
TimeoutControl = Mock.Of<ITimeoutControl>() TimeoutControl = Mock.Of<ITimeoutControl>()

View File

@ -38,7 +38,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
ServiceContext = new TestServiceContext(), ServiceContext = new TestServiceContext(),
ConnectionContext = Mock.Of<ConnectionContext>(), ConnectionContext = Mock.Of<ConnectionContext>(),
ConnectionFeatures = connectionFeatures, ConnectionFeatures = connectionFeatures,
Application = Application,
Transport = Transport, Transport = Transport,
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
TimeoutControl = Mock.Of<ITimeoutControl>() TimeoutControl = Mock.Of<ITimeoutControl>()

View File

@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
using Moq;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests

View File

@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Connections;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
using Moq; using Moq;
using Xunit; using Xunit;
@ -280,10 +281,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
_connectionContext = new Http2ConnectionContext _connectionContext = new Http2ConnectionContext
{ {
ConnectionContext = Mock.Of<ConnectionContext>(),
ConnectionFeatures = new FeatureCollection(), ConnectionFeatures = new FeatureCollection(),
ServiceContext = new TestServiceContext(LoggerFactory, mockKestrelTrace.Object), ServiceContext = new TestServiceContext(LoggerFactory, mockKestrelTrace.Object),
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
Application = _pair.Application,
Transport = _pair.Transport Transport = _pair.Transport
}; };

View File

@ -743,7 +743,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
ConnectionFeatures = connectionFeatures, ConnectionFeatures = connectionFeatures,
MemoryPool = _memoryPool, MemoryPool = _memoryPool,
TimeoutControl = Mock.Of<ITimeoutControl>(), TimeoutControl = Mock.Of<ITimeoutControl>(),
Application = pair.Application,
Transport = pair.Transport Transport = pair.Transport
}); });