void CompleteRead()
{
var tmp = _currentInputSegment;
_currentInputSegment = _nextInputSegment;
_currentInputSegment.GetResult();
_nextInputSegment = tmp;
if (_currentInputSegment.CurrentContentLength != 0)
_socket.BeginReceive(_nextInputSegment);
OnIncommingSegment(_currentInputSegment);
if (_currentInputSegment.CurrentContentLength != 0)
{
if (_nextInputSegment.IsCompleted)
CompleteRead();
else
_nextInputSegment.OnCompleted(completeReadDelegate);
}
else {
Dispose();
}
}