Exemplo n.º 1
0
 public TcpChannel(IPipeline pipeline, BufferPool pool)
 {
     _pipeline = pipeline;
     Pipeline.SetChannel(this);
     _readBuffer = pool.PopSlice();
     _stream = new PeekableMemoryStream(_readBuffer.Buffer, _readBuffer.StartOffset, _readBuffer.Capacity);
 }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 3
0
        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;
        }