Esempio n. 1
0
 private static void OnFinalizeCorrelationCompletedCallback(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         bool flag;
         ContextOutputChannelBase <TChannel> .SendAsyncResult asyncState = (ContextOutputChannelBase <TChannel> .SendAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             flag = asyncState.OnFinalizeCorrelationCompleted(result);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             exception = exception2;
             flag      = true;
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
Esempio n. 2
0
            public SendAsyncResult(Message message, ContextOutputChannelBase <TChannel> channel, ContextProtocol contextProtocol, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
            {
                this.channel       = channel;
                this.message       = this.sendMessage = message;
                this.timeoutHelper = new TimeoutHelper(timeout);
                bool flag = true;

                if (message != null)
                {
                    contextProtocol.OnOutgoingMessage(message, null);
                    if (CorrelationCallbackMessageProperty.TryGet(message, out this.correlationCallback))
                    {
                        ContextExchangeCorrelationHelper.AddOutgoingCorrelationCallbackData(this.correlationCallback, message, this.channel.IsClient);
                        if (this.correlationCallback.IsFullyDefined)
                        {
                            IAsyncResult result = this.correlationCallback.BeginFinalizeCorrelation(this.message, this.timeoutHelper.RemainingTime(), ContextOutputChannelBase <TChannel> .SendAsyncResult.onFinalizeCorrelation, this);
                            if (result.CompletedSynchronously && this.OnFinalizeCorrelationCompleted(result))
                            {
                                base.Complete(true);
                            }
                            flag = false;
                        }
                    }
                }
                if (flag)
                {
                    IAsyncResult result2 = this.channel.InnerChannel.BeginSend(this.message, this.timeoutHelper.RemainingTime(), ContextOutputChannelBase <TChannel> .SendAsyncResult.onSend, this);
                    if (result2.CompletedSynchronously)
                    {
                        this.OnSendCompleted(result2);
                        base.Complete(true);
                    }
                }
            }
Esempio n. 3
0
 private static void OnSendCompletedCallback(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ContextOutputChannelBase <TChannel> .SendAsyncResult asyncState = (ContextOutputChannelBase <TChannel> .SendAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             asyncState.OnSendCompleted(result);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             exception = exception2;
         }
         asyncState.Complete(false, exception);
     }
 }