Пример #1
0
 private static void OnConnect(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         bool flag;
         ConnectionPoolHelper.EstablishConnectionAsyncResult asyncState = (ConnectionPoolHelper.EstablishConnectionAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             flag = asyncState.HandleConnect(result);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             flag      = true;
             exception = exception2;
         }
         if (flag)
         {
             asyncState.Cleanup();
             asyncState.Complete(false, exception);
         }
     }
 }
Пример #2
0
 private static void OnProcessConnection(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         bool flag;
         ConnectionPoolHelper.EstablishConnectionAsyncResult asyncState = (ConnectionPoolHelper.EstablishConnectionAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             bool flag2 = false;
             try
             {
                 flag = asyncState.HandleProcessConnection(result);
                 if (flag)
                 {
                     flag2 = true;
                 }
             }
             catch (CommunicationException exception2)
             {
                 if (!asyncState.newConnection)
                 {
                     if (DiagnosticUtility.ShouldTraceInformation)
                     {
                         DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
                     }
                     asyncState.Cleanup();
                     flag = asyncState.Begin();
                 }
                 else
                 {
                     flag      = true;
                     exception = exception2;
                 }
             }
             catch (TimeoutException exception3)
             {
                 if (!asyncState.newConnection)
                 {
                     if (DiagnosticUtility.ShouldTraceInformation)
                     {
                         DiagnosticUtility.ExceptionUtility.TraceHandledException(exception3, TraceEventType.Information);
                     }
                     asyncState.Cleanup();
                     flag = asyncState.Begin();
                 }
                 else
                 {
                     flag      = true;
                     exception = exception3;
                 }
             }
             if (flag2)
             {
                 asyncState.SnapshotConnection();
             }
         }
         catch (Exception exception4)
         {
             if (Fx.IsFatal(exception4))
             {
                 throw;
             }
             flag      = true;
             exception = exception4;
         }
         if (flag)
         {
             asyncState.Cleanup();
             asyncState.Complete(false, exception);
         }
     }
 }