using System.Buffers; using System.Collections.Generic; using System.IO.Pipelines; using System.Net; using System.Threading; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Http.Features; namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal { public abstract partial class TransportConnection : ConnectionContext { private IDictionary _items; public TransportConnection() { _currentIConnectionIdFeature = this; _currentIConnectionTransportFeature = this; _currentIHttpConnectionFeature = this; _currentIConnectionItemsFeature = this; _currentIApplicationTransportFeature = this; _currentIMemoryPoolFeature = this; _currentITransportSchedulerFeature = this; } public IPAddress RemoteAddress { get; set; } public int RemotePort { get; set; } public IPAddress LocalAddress { get; set; } public int LocalPort { get; set; } public override string ConnectionId { get; set; } public override IFeatureCollection Features => this; public virtual MemoryPool MemoryPool { get; } public virtual PipeScheduler InputWriterScheduler { get; } public virtual PipeScheduler OutputReaderScheduler { get; } public override IDuplexPipe Transport { get; set; } public IDuplexPipe Application { get; set; } public override IDictionary Items { get { // Lazily allocate connection metadata return _items ?? (_items = new ConnectionItems()); } set { _items = value; } } public PipeWriter Input => Application.Output; public PipeReader Output => Application.Input; } }