public Http2OutputProducer(Http2Stream stream, Http2StreamContext context) { _stream = stream; _frameWriter = context.FrameWriter; _memoryPool = context.MemoryPool; _log = context.ServiceContext.Log; var scheduleInline = context.ServiceContext.Scheduler == PipeScheduler.Inline; _pipe = CreateDataPipe(_memoryPool, scheduleInline); _pipeWriter = new ConcurrentPipeWriter(_pipe.Writer, _memoryPool, _dataWriterLock); _pipeReader = _pipe.Reader; // No need to pass in timeoutControl here, since no minDataRates are passed to the TimingPipeFlusher. // The minimum output data rate is enforced at the connection level by Http2FrameWriter. _flusher = new TimingPipeFlusher(timeoutControl: null, _log); _flusher.Initialize(_pipeWriter); _streamWindow = context.ClientPeerSettings.InitialWindowSize; }
public Http2OutputProducer(Http2Stream stream, Http2StreamContext context, StreamOutputFlowControl flowControl) { _stream = stream; _frameWriter = context.FrameWriter; _flowControl = flowControl; _memoryPool = context.MemoryPool; _log = context.ServiceContext.Log; _pipe = CreateDataPipe(_memoryPool); _pipeWriter = new ConcurrentPipeWriter(_pipe.Writer, _memoryPool, _dataWriterLock); _pipeReader = _pipe.Reader; // No need to pass in timeoutControl here, since no minDataRates are passed to the TimingPipeFlusher. // The minimum output data rate is enforced at the connection level by Http2FrameWriter. _flusher = new TimingPipeFlusher(timeoutControl: null, _log); _flusher.Initialize(_pipeWriter); _dataWriteProcessingTask = ProcessDataWrites(); }
public void Initialize(Http2StreamContext context) { base.Initialize(context); _decrementCalled = false; _completionState = StreamCompletionFlags.None; InputRemaining = null; RequestBodyStarted = false; DrainExpirationTicks = 0; _context = context; // First time the stream is used we need to create flow control, producer and pipes. // When a stream is reused these types will be reset and reused. if (_inputFlowControl == null) { _inputFlowControl = new StreamInputFlowControl( this, context.FrameWriter, context.ConnectionInputFlowControl, context.ServerPeerSettings.InitialWindowSize, context.ServerPeerSettings.InitialWindowSize / 2); _outputFlowControl = new StreamOutputFlowControl( context.ConnectionOutputFlowControl, context.ClientPeerSettings.InitialWindowSize); _http2Output = new Http2OutputProducer(this, context, _outputFlowControl); RequestBodyPipe = CreateRequestBodyPipe(); Output = _http2Output; } else { _inputFlowControl.Reset(); _outputFlowControl.Reset(context.ClientPeerSettings.InitialWindowSize); _http2Output.StreamReset(); RequestBodyPipe.Reset(); } }
public HttpProtocolFeatureCollectionTests() { var context = new Http2StreamContext { ServiceContext = new TestServiceContext(), ConnectionFeatures = new FeatureCollection(), TimeoutControl = Mock.Of <ITimeoutControl>(), Transport = Mock.Of <IDuplexPipe>(), ServerPeerSettings = new Http2PeerSettings(), ClientPeerSettings = new Http2PeerSettings(), }; _httpConnectionContext = context; _http1Connection = new TestHttp1Connection(context); _http1Connection.Reset(); _collection = _http1Connection; var http2Stream = new TestHttp2Stream(context); http2Stream.Reset(); _http2Collection = http2Stream; }
public static Http2StreamContext CreateHttp2StreamContext( string connectionId = null, ServiceContext serviceContext = null, IFeatureCollection connectionFeatures = null, MemoryPool <byte> memoryPool = null, IPEndPoint localEndPoint = null, IPEndPoint remoteEndPoint = null, int?streamId = null, IHttp2StreamLifetimeHandler streamLifetimeHandler = null, Http2PeerSettings clientPeerSettings = null, Http2PeerSettings serverPeerSettings = null, Http2FrameWriter frameWriter = null, InputFlowControl connectionInputFlowControl = null, OutputFlowControl connectionOutputFlowControl = null, ITimeoutControl timeoutControl = null) { var context = new Http2StreamContext ( connectionId: connectionId ?? "TestConnectionId", protocols: HttpProtocols.Http2, altSvcHeader: null, serviceContext: serviceContext ?? CreateServiceContext(new KestrelServerOptions()), connectionFeatures: connectionFeatures ?? new FeatureCollection(), memoryPool: memoryPool ?? MemoryPool <byte> .Shared, localEndPoint: localEndPoint, remoteEndPoint: remoteEndPoint, streamId: streamId ?? 0, streamLifetimeHandler: streamLifetimeHandler, clientPeerSettings: clientPeerSettings ?? new Http2PeerSettings(), serverPeerSettings: serverPeerSettings ?? new Http2PeerSettings(), frameWriter: frameWriter, connectionInputFlowControl: connectionInputFlowControl, connectionOutputFlowControl: connectionOutputFlowControl ); context.TimeoutControl = timeoutControl; return(context); }
public TestHttp2Stream(Http2StreamContext context) : base(context) { }
public TestHttp2Stream(Http2StreamContext context) { InitializePooled(context, reset: true); }
public Http2Stream(IHttpApplication <TContext> application, Http2StreamContext context) { Initialize(context); _application = application; }
public TestHttp2Stream(Http2StreamContext context) { Initialize(context); }