private bool CheckCompletionBeforeNextRead(int bytes)
{
if (bytes == 0)
{
// 0 bytes was requested or EOF in the beginning of a frame, the caller should decide whether it's OK.
if (_totalRead == 0)
{
_request.CompleteRequest(0);
return(true);
}
// EOF in the middle of a frame.
throw new IOException(SR.net_io_eof);
}
if (_totalRead + bytes > _request.Count)
{
if (GlobalLog.IsEnabled)
{
GlobalLog.AssertFormat("FixedSizeReader::CheckCompletion()|State got out of range. Total:{0} Count:{1}", _totalRead + bytes, _request.Count);
}
Debug.Fail("FixedSizeReader::CheckCompletion()|State got out of range. Total:" + (_totalRead + bytes) + " Count:" + _request.Count);
}
if ((_totalRead += bytes) == _request.Count)
{
_request.CompleteRequest(_request.Count);
return(true);
}
return(false);
}