3 writes to _readBuffer
System.Net.Http (3)
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (3)
87_readBuffer = new ArrayBuffer(InitialReadBufferSize, usePool: false); 1974_readBuffer = new ArrayBuffer(pooledBuffer); 1992_readBuffer = new ArrayBuffer(origReadBuffer);
66 references to _readBuffer
System.Net.Http (66)
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (66)
169_readAheadTask = _stream.ReadAsync(_readBuffer.AvailableMemory); 247Debug.Assert(_readBuffer.ActiveLength == 0); 258int read = await _stream.ReadAsync(_readBuffer.AvailableMemory).ConfigureAwait(false); 299private int ReadBufferSize => _readBuffer.Capacity; 301private ReadOnlyMemory<byte> RemainingBuffer => _readBuffer.ActiveMemory; 305Debug.Assert(bytesToConsume <= _readBuffer.ActiveLength); 306_readBuffer.Discard(bytesToConsume); 535Debug.Assert(_readBuffer.ActiveLength == 0, "Unexpected data in read buffer"); 601Debug.Assert(_readBuffer.ActiveLength == 0); 636_readBuffer.Commit(bytesRead); 648if (_readBuffer.ActiveLength == 0) 1029Span<byte> buffer = _readBuffer.ActiveSpan; 1035_readBuffer.Discard(bytesConsumed); 1131Span<byte> buffer = _readBuffer.ActiveSpan; 1141_readBuffer.Discard(bytesConsumed); 1589ReadOnlySpan<byte> buffer = _readBuffer.ActiveReadOnlySpan; 1605_readBuffer.Discard(bytesConsumed); 1625Debug.Assert(_readBuffer.AvailableLength == _readBuffer.Capacity); 1626Debug.Assert(_readBuffer.AvailableLength >= InitialReadBufferSize); 1629await _stream.ReadAsync(_readBuffer.AvailableMemory).ConfigureAwait(false) : 1630_stream.Read(_readBuffer.AvailableSpan); 1632_readBuffer.Commit(bytesRead); 1642_readBuffer.EnsureAvailableSpace(1); 1645await _stream.ReadAsync(_readBuffer.AvailableMemory).ConfigureAwait(false) : 1646_stream.Read(_readBuffer.AvailableSpan); 1648_readBuffer.Commit(bytesRead); 1661return _readBuffer.ActiveStartOffset == 0 1669int searchOffset = _readBuffer.ActiveLength; 1680Debug.Assert(_readBuffer.ActiveStartOffset == 0); 1681Debug.Assert(_readBuffer.ActiveLength > searchOffset); 1684if (TryFindEndOfLine(_readBuffer.ActiveReadOnlySpan.Slice(searchOffset), out int offset)) 1691int readLength = _readBuffer.ActiveLength; 1694Debug.Assert(searchOffset == readLength - 1 && _readBuffer.ActiveReadOnlySpan[searchOffset] == '\n'); 1746ReadOnlySpan<byte> available = _readBuffer.ActiveSpan; 1750_readBuffer.Discard(toCopy); 1759if (_readBuffer.ActiveLength > 0) 1777if (_readBuffer.ActiveLength > 0) 1803if (_readBuffer.ActiveLength == 0) 1813Debug.Assert(_readBuffer.AvailableLength == _readBuffer.Capacity); 1814int bytesRead = _stream.Read(_readBuffer.AvailableSpan); 1815_readBuffer.Commit(bytesRead); 1831return destination.Length >= _readBuffer.Capacity || destination.Length == 0 ? 1841if (_readBuffer.ActiveLength == 0) 1846Debug.Assert(_readBuffer.AvailableLength == _readBuffer.Capacity); 1847int bytesRead = await _stream.ReadAsync(_readBuffer.AvailableMemory).ConfigureAwait(false); 1848_readBuffer.Commit(bytesRead); 1859Debug.Assert(count <= _readBuffer.ActiveLength); 1863ReadOnlyMemory<byte> source = _readBuffer.ActiveMemory.Slice(0, count); 1864_readBuffer.Discard(count); 1881if (_readBuffer.ActiveLength > 0) 1897int remaining = _readBuffer.ActiveLength; 1919int remaining = _readBuffer.ActiveLength; 1934Debug.Assert(_readBuffer.ActiveLength == 0, "HttpConnection's buffer should have been empty."); 1951remaining = (int)Math.Min((ulong)_readBuffer.ActiveLength, length); 1966int currentCapacity = _readBuffer.Capacity; 1972origReadBuffer = _readBuffer.DangerousGetUnderlyingBuffer(); 1989bool anyDataAvailable = _readBuffer.ActiveLength > 0; 1991byte[] pooledBuffer = _readBuffer.DangerousGetUnderlyingBuffer(); 1997_readBuffer.Commit(1); 2048if (_readBuffer.ActiveLength > 0) 2055_readBuffer.Discard(_readBuffer.ActiveLength); 2103Debug.Assert(_readBuffer.ActiveLength == 0, "Unexpected data in connection read buffer.");