Example #1
0
 public ReadAsyncEventArgs(int bufferSize)
 {
     this.bufferSize = bufferSize;
     this.segment    = SmallBufferPool.TakeBuffer(FixedWidth.ULong);
     if (bufferSize == 0)
     {
         this.readTracker = new BufferSizeTracker(512);
     }
     else
     {
         this.readBuffer = new ByteBuffer(bufferSize, false, true);
     }
 }
Example #2
0
            public new void Dispose()
            {
                ByteBuffer temp = this.readBuffer;

                if (temp != null)
                {
                    temp.Dispose();
                }

                ArraySegment <byte> copy = this.segment;

                if (copy.Array != null)
                {
                    this.segment = default(ArraySegment <byte>);
                    SmallBufferPool.ReturnBuffer(copy);
                }

                base.Dispose();
            }