CheckCompletionBeforeNextReceive() private method

private CheckCompletionBeforeNextReceive ( LazyAsyncResult lazyResult ) : void
lazyResult LazyAsyncResult
return void
Beispiel #1
0
 private static void WriteCallback(IAsyncResult transportResult)
 {
     if (!transportResult.CompletedSynchronously)
     {
         LazyAsyncResult asyncState = (LazyAsyncResult)transportResult.AsyncState;
         try
         {
             NegoState asyncObject = (NegoState)asyncState.AsyncObject;
             asyncObject._Framer.EndWriteMessage(transportResult);
             if (asyncState.Result is Exception)
             {
                 asyncObject._CanRetryAuthentication = true;
                 throw ((Exception)asyncState.Result);
             }
             asyncObject.CheckCompletionBeforeNextReceive(asyncState);
         }
         catch (Exception exception)
         {
             if (asyncState.InternalPeekCompleted)
             {
                 throw;
             }
             asyncState.InvokeCallback(exception);
         }
     }
 }
Beispiel #2
0
        //
        //
        //
        private static void WriteCallback(IAsyncResult transportResult)
        {
            GlobalLog.Assert(transportResult.AsyncState is LazyAsyncResult, "WriteCallback|State type is wrong, expected LazyAsyncResult.");
            if (transportResult.CompletedSynchronously)
            {
                return;
            }

            LazyAsyncResult lazyResult = (LazyAsyncResult)transportResult.AsyncState;

            // Async completion
            try
            {
                NegoState authState = (NegoState)lazyResult.AsyncObject;
                authState._Framer.EndWriteMessage(transportResult);

                //special case for an error notification
                if (lazyResult.Result is Exception)
                {
                    authState._CanRetryAuthentication = true;
                    throw (Exception)lazyResult.Result;
                }
                authState.CheckCompletionBeforeNextReceive(lazyResult);
            }
            catch (Exception e)
            {
                if (lazyResult.InternalPeekCompleted)
                {
                    // This will throw on a worker thread.
                    throw;
                }
                lazyResult.InvokeCallback(e);
            }
        }
Beispiel #3
0
        private static void WriteCallback(IAsyncResult transportResult)
        {
            if (!(transportResult.AsyncState is LazyAsyncResult))
            {
                NetEventSource.Fail(transportResult, "State type is wrong, expected LazyAsyncResult.");
            }

            if (transportResult.CompletedSynchronously)
            {
                return;
            }

            LazyAsyncResult lazyResult = (LazyAsyncResult)transportResult.AsyncState;

            // Async completion.
            try
            {
                NegoState authState = (NegoState)lazyResult.AsyncObject;
                authState._framer.EndWriteMessage(transportResult);

                // Special case for an error notification.
                if (lazyResult.Result is Exception e)
                {
                    authState._canRetryAuthentication = true;
                    ExceptionDispatchInfo.Throw(e);
                }

                authState.CheckCompletionBeforeNextReceive(lazyResult);
            }
            catch (Exception e)
            {
                if (lazyResult.InternalPeekCompleted)
                {
                    // This will throw on a worker thread.
                    throw;
                }

                lazyResult.InvokeCallback(e);
            }
        }