public void Initialize(Http2StreamContext context) { base.Initialize(context); CanReuse = false; _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(); } }