Ejemplo n.º 1
0
        //public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
        //{
        //    Write(buffer, offset, size);
        //    return new CompletedAsyncResult(callback, state);
        //}

        //public override void EndWrite(IAsyncResult result)
        //{
        //    CompletedAsyncResult.End(result);
        //}

        public void Clear()
        {
            if (!_callerReturnsBuffer)
            {
                for (int i = 0; i < _chunkCount; i++)
                {
                    _bufferManager.ReturnBuffer(_chunks[i]);
                    _chunks[i] = null;
                }
            }

            _callerReturnsBuffer = false;
            _initialized         = false;
            _bufferReturned      = false;
            _chunkCount          = 0;
            _currentChunk        = null;
        }
Ejemplo n.º 2
0
        //public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
        //{
        //    Write(buffer, offset, size);
        //    return new CompletedAsyncResult(callback, state);
        //}

        //public override void EndWrite(IAsyncResult result)
        //{
        //    CompletedAsyncResult.End(result);
        //}

        public void Clear()
        {
            if (!callerReturnsBuffer)
            {
                for (int i = 0; i < chunkCount; i++)
                {
                    bufferManager.ReturnBuffer(chunks[i]);
                    chunks[i] = null;
                }
            }

            callerReturnsBuffer = false;
            initialized         = false;
            bufferReturned      = false;
            chunkCount          = 0;
            currentChunk        = null;
        }