private static void CompleteIO(IAsyncResult result)
        {
            BufferAsyncResult asyncState = (BufferAsyncResult)result.AsyncState;
            object            obj2       = null;

            if (asyncState.IsWrite)
            {
                ((TlsStream)asyncState.AsyncObject).m_Worker.SecureStream.EndWrite(result);
            }
            else
            {
                obj2 = ((TlsStream)asyncState.AsyncObject).m_Worker.SecureStream.EndRead(result);
            }
            asyncState.InvokeCallback(obj2);
        }
Example #2
0
        private static void CompleteIO(IAsyncResult result)
        {
            BufferAsyncResult bufferResult = (BufferAsyncResult)result.AsyncState;

            object readBytes = null;

            if (bufferResult.IsWrite)
            {
                ((TlsStream)bufferResult.AsyncObject).m_Worker.SecureStream.EndWrite(result);
            }
            else
            {
                readBytes = ((TlsStream)bufferResult.AsyncObject).m_Worker.SecureStream.EndRead(result);
            }

            bufferResult.InvokeCallback(readBytes);
        }
Example #3
0
        private void ResumeIOWorker(object result)
        {
            BufferAsyncResult bufferResult = (BufferAsyncResult)result;

            try
            {
                ResumeIO(bufferResult);
            }
            catch (Exception exception)
            {
                if (exception is OutOfMemoryException || exception is StackOverflowException || exception is ThreadAbortException)
                {
                    throw;
                }
                if (bufferResult.InternalPeekCompleted)
                {
                    throw;
                }
                bufferResult.InvokeCallback(exception);
            }
        }