private void PostReceive()
{
GlobalLog.Enter("Connection#" + ValidationHelper.HashString(this) + "::PostReceive", "");
GlobalLog.Print("Connection#" + ValidationHelper.HashString(this) + "::PostReceive() m_ReadBuffer:" + ValidationHelper.HashString(m_ReadBuffer) + " Length:" + m_ReadBuffer.Length.ToString());
try
{
GlobalLog.Assert(m_BytesScanned == 0, "PostReceive()|A receive should not be posted when m_BytesScanned != 0 (the data should be moved to offset 0).");
if (m_LastAsyncResult != null && !m_LastAsyncResult.IsCompleted)
throw new InternalException(); //This may cause duplicate requests if we let it through in retail
m_LastAsyncResult = UnsafeBeginRead(m_ReadBuffer, m_BytesRead, m_ReadBuffer.Length - m_BytesRead, m_ReadCallback, this);
if (m_LastAsyncResult.CompletedSynchronously)
{
ReadCallback(m_LastAsyncResult);
}
}
catch (Exception exception) {
// Notify request's SubmitWriteStream that a socket error happened. This will cause future writes to
// throw an IOException.
HttpWebRequest curRequest = m_CurrentRequest;
if (curRequest != null)
{
curRequest.ErrorStatusCodeNotify(this, false, true);
}
//ASYNCISSUE
ConnectionReturnResult returnResult = null;
HandleErrorWithReadDone(WebExceptionStatus.ReceiveFailure, ref returnResult);
ConnectionReturnResult.SetResponses(returnResult);
GlobalLog.LeaveException("Connection#" + ValidationHelper.HashString(this) + "::PostReceive", exception);
}
GlobalLog.Leave("Connection#" + ValidationHelper.HashString(this) + "::PostReceive");
}