internal void ProcessWriteCallDone(ConnectionReturnResult returnResult)
{
GlobalLog.Print("ConnectStream#" + ValidationHelper.HashString(this) + "::ProcessWriteCallDone()");
try {
if (returnResult == null) {
m_Connection.WriteStartNextRequest(m_Request, ref returnResult);
// If the request is Sync, then we do our Read here for data
if (!m_Request.Async)
{
object syncReaderResult = m_Request.ConnectionReaderAsyncResult.InternalWaitForCompletion();
//we should only do a syncread if we didn't already read the response
//via poll when we handed back the request stream
if (syncReaderResult == null && !m_Request.SawInitialResponse)
#if DEBUG
// Remove once mixed sync/async requests are supported.
using (GlobalLog.SetThreadKind(ThreadKinds.Sync))
#endif
{
m_Connection.SyncRead(m_Request, true, false);
}
}
m_Request.SawInitialResponse = false;
}
ConnectionReturnResult.SetResponses(returnResult);
}
finally {
// This will decrement the response window on the write side AND may
// result in either immediate or delayed processing of a response for the m_Request instance
if (IsPostStream || m_Request.Async)
m_Request.CheckWriteSideResponseProcessing();
}
}