public TcpChannel(IPipeline pipeline, BufferPool pool) { _pipeline = pipeline; Pipeline.SetChannel(this); _readBuffer = pool.PopSlice(); _stream = new PeekableMemoryStream(_readBuffer.Buffer, _readBuffer.StartOffset, _readBuffer.Capacity); }
/// <summary> /// Initializes a new instance of the <see cref="TcpChannel"/> class. /// </summary> /// <param name="pipeline">The pipeline used to send messages upstream.</param> /// <param name="pool">Buffer pool.</param> public TcpChannel(IPipeline pipeline, BufferPool pool) { _pipeline = pipeline; _pool = pool; Pipeline.SetChannel(this); if (pool == null) _readBuffer = new BufferSlice(new byte[65535], 0, 65535, 0); else _readBuffer = pool.PopSlice(); _stream = new PeekableMemoryStream(_readBuffer.Buffer, _readBuffer.StartOffset, _readBuffer.Capacity); }
public BufferPoolStream2(BufferPool bufferPool) { _bufferPool = bufferPool; _canWrite = true; _slice = bufferPool.PopSlice(); _buffer = _slice.Buffer; _capacity = _slice.Capacity; _length = _slice.Count; _position = _slice.Position; _initialIndex = _slice.StartOffset; }