예제 #1
0
            private static void OnReadUpgradeResponse(object state)
            {
                ConnectionUpgradeHelper.InitiateUpgradeAsyncResult result = (ConnectionUpgradeHelper.InitiateUpgradeAsyncResult)state;
                Exception exception = null;
                bool      flag      = false;

                try
                {
                    if (result.CompleteReadUpgradeResponse())
                    {
                        flag = result.Begin();
                    }
                }
                catch (Exception exception2)
                {
                    if (Fx.IsFatal(exception2))
                    {
                        throw;
                    }
                    flag      = true;
                    exception = exception2;
                }
                if (flag)
                {
                    result.Complete(false, exception);
                }
            }
예제 #2
0
 private static void OnWriteUpgradeBytes(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ConnectionUpgradeHelper.InitiateUpgradeAsyncResult asyncState = (ConnectionUpgradeHelper.InitiateUpgradeAsyncResult)result.AsyncState;
         Exception exception = null;
         bool      flag      = false;
         try
         {
             if (asyncState.CompleteWriteUpgradeBytes(result))
             {
                 flag = asyncState.Begin();
             }
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             flag      = true;
             exception = exception2;
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
예제 #3
0
 private static void OnFailedUpgrade(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ConnectionUpgradeHelper.InitiateUpgradeAsyncResult asyncState = (ConnectionUpgradeHelper.InitiateUpgradeAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             ConnectionUpgradeHelper.EndDecodeFramingFault(result);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             exception = exception2;
         }
         asyncState.Complete(false, exception);
     }
 }