private void CompleteRead() { var toCopy = _currentContentLength - _bytesReadInCurrentSegment; if (toCopy > _readCount) { toCopy = _readCount; } unsafe { fixed(byte *p = &_readBuffer[_readoffset]) System.Buffer.MemoryCopy(_currentInputSegment.RawPointer + _bytesReadInCurrentSegment, p, _readCount, toCopy); } _bytesReadInCurrentSegment += toCopy; if (_currentContentLength == _bytesReadInCurrentSegment) { _currentInputSegment.Dispose(); _currentInputSegment = null; } _readtcs.SetResult(toCopy); }
private void GetNewSegment() { _currentInputSegment = _incommingSegments.GetResult(); if (_currentInputSegment == null) { _readtcs.SetResult(0); return; } _bytesReadInCurrentSegment = 0; _currentContentLength = _currentInputSegment.CurrentContentLength; if (_currentContentLength == 0) { _currentInputSegment.Dispose(); _currentInputSegment = null; _readtcs.SetResult(0); return; } else { _socket.ReciveInternal(); CompleteRead(); } }
public void Dispose() { _currentValue?.Dispose(); _currentValue = null; if (_continuation != null) { _continuation(); } }
protected override void Dispose(bool disposing) { Flush(false); if (_currentInputSegment != null) { _currentInputSegment.Dispose(); } _currentOutputSegment.Dispose(); _incommingSegments.Dispose(); }
private void GetNewSegment() { _currentInputSegment = _incommingSegments.GetResult(); if (_currentInputSegment == null) { _readtcs.SetResult(0); return; } _bytesReadInCurrentSegment = 0; _currentContentLength = _currentInputSegment.CurrentContentLength; if (_currentContentLength == 0) { _currentInputSegment.Dispose(); _currentInputSegment = null; _readtcs.SetResult(0); return; } else { _socket.ReciveInternal(); CompleteRead(); } }