예제 #1
0
        static void OnAuthenticateAsServer(IAsyncResult result)
        {
            if (result.CompletedSynchronously)
            {
                return;
            }

            StreamSecurityUpgradeAcceptorAsyncResult acceptUpgradeAsyncResult =
                (StreamSecurityUpgradeAcceptorAsyncResult)result.AsyncState;

            Exception completionException = null;

            try
            {
                acceptUpgradeAsyncResult.CompleteAuthenticateAsServer(result);
            }
#pragma warning suppress 56500 // Microsoft, transferring exception to another thread
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }
                completionException = e;
            }
            acceptUpgradeAsyncResult.Complete(false, completionException);
        }
예제 #2
0
 private static void OnAuthenticateAsServer(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         StreamSecurityUpgradeAcceptorAsyncResult asyncState = (StreamSecurityUpgradeAcceptorAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             asyncState.CompleteAuthenticateAsServer(result);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             exception = exception2;
         }
         asyncState.Complete(false, exception);
     }
 }