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 RioStream(RioConnectionOrientedSocket socket) { _socket = socket; _currentInputSegment = null; _currentOutputSegment = _socket.SendBufferPool.GetBuffer(); _getNewSegmentDelegate = GetNewSegment; socket.OnIncommingSegment = s => _incommingSegments.Set(s); socket.ReciveInternal(); }