public void UpdateWindows(int bytes)
        {
            if (!_streamLevelFlowControl.TryUpdateWindow(bytes, out var streamWindowUpdateSize))
            {
                // Stream-level flow control was aborted. Any unread bytes have already been returned to the connection
                // flow-control window by Abort().
                return;
            }

            if (streamWindowUpdateSize > 0)
            {
                // Writing with the FrameWriter should only fail if given a canceled token, so just fire and forget.
                _ = _frameWriter.WriteWindowUpdateAsync(_streamId, streamWindowUpdateSize);
            }

            UpdateConnectionWindow(bytes);
        }
Beispiel #2
0
        public async Task WriteWindowUpdate_UnsetsReservedBit()
        {
            // Arrange
            var pipe        = new Pipe(new PipeOptions(_dirtyMemoryPool, PipeScheduler.Inline, PipeScheduler.Inline));
            var frameWriter = new Http2FrameWriter(pipe.Writer, null, null, null, null, null, null, _dirtyMemoryPool, new Mock <IKestrelTrace>().Object);

            // Act
            await frameWriter.WriteWindowUpdateAsync(1, 1);

            // Assert
            var payload = await pipe.Reader.ReadForLengthAsync(Http2FrameReader.HeaderLength + 4);

            Assert.Equal(new byte[] { 0x00, 0x00, 0x00, 0x01 }, payload.Skip(Http2FrameReader.HeaderLength).Take(4).ToArray());
        }