System.Net.ConnectStream.ProcessWriteCallDone C# (CSharp) Method

ProcessWriteCallDone() private method

private ProcessWriteCallDone ( ConnectionReturnResult returnResult ) : void
returnResult ConnectionReturnResult
return void
        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();
            }
        }

Usage Example

Beispiel #1
0
        private void CheckDeferredCallDone(ConnectStream stream)
        {
            object returnResult = Interlocked.Exchange(ref m_PendingReturnResult, DBNull.Value);
            if (returnResult == NclConstants.Sentinel)
            {
#if DEBUG
                if (!Async)
                {
                    using (GlobalLog.SetThreadKind(ThreadKinds.Sync)) {
                        EndSubmitRequest();
                    }
                }
                else
#endif
                EndSubmitRequest();
            }
            else if (returnResult != null && returnResult != DBNull.Value)
            {
                // It could still be Missing.Value, which indicates ProcessWriteCallDone() should be called with null.
                stream.ProcessWriteCallDone(returnResult as ConnectionReturnResult);
            }
        }
All Usage Examples Of System.Net.ConnectStream::ProcessWriteCallDone