Exemplo n.º 1
0
 private static void OpenChannelCallback(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         IssuanceTokenProviderBase <T> .SecurityNegotiationAsyncResult asyncState = (IssuanceTokenProviderBase <T> .SecurityNegotiationAsyncResult)result.AsyncState;
         bool      flag      = false;
         Exception exception = null;
         try
         {
             asyncState.rstChannel.EndOpen(result);
             flag = asyncState.OnRequestChannelOpened();
             if (flag)
             {
                 asyncState.OnNegotiationComplete();
             }
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             flag      = true;
             exception = asyncState.OnAsyncNegotiationFailure(exception2);
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
Exemplo n.º 2
0
 private static void SendRequestCallback(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         IssuanceTokenProviderBase <T> .SecurityNegotiationAsyncResult asyncState = (IssuanceTokenProviderBase <T> .SecurityNegotiationAsyncResult)result.AsyncState;
         bool      flag      = false;
         Exception exception = null;
         try
         {
             Message incomingMessage = null;
             try
             {
                 incomingMessage = asyncState.rstChannel.EndRequest(result);
             }
             finally
             {
                 if (asyncState.nextOutgoingMessage != null)
                 {
                     asyncState.nextOutgoingMessage.Close();
                 }
             }
             using (incomingMessage)
             {
                 if (incomingMessage == null)
                 {
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityNegotiationException(System.ServiceModel.SR.GetString("FailToRecieveReplyFromNegotiation")));
                 }
                 flag = asyncState.DoNegotiation(incomingMessage);
             }
             if (flag)
             {
                 asyncState.OnNegotiationComplete();
             }
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             flag      = true;
             exception = asyncState.OnAsyncNegotiationFailure(exception2);
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }