public void ReceiveFlowControlledFrame(IHttp2Stream stream, IByteBuffer data, int padding, bool endOfStream) { Debug.Assert(_ctx is object && _ctx.Executor.InEventLoop); int dataLength = data.ReadableBytes + padding; // Apply the connection-level flow control IFlowState connectionState = ConnectionState(); connectionState.ReceiveFlowControlledFrame(dataLength); if (stream is object && !IsClosed(stream)) { // Apply the stream-level flow control IFlowState state = GetState(stream); state.EndOfStream(endOfStream); state.ReceiveFlowControlledFrame(dataLength); } else if (dataLength > 0) { // Immediately consume the bytes for the connection window. _ = connectionState.ConsumeBytes(dataLength); } }
private bool ConsumeAllBytes(IFlowState state, int numBytes) { return(ConnectionState().ConsumeBytes(numBytes) | state.ConsumeBytes(numBytes)); }