Пример #1
0
        public static Message End(IAsyncResult result, out Exception handledException)
        {
            ReliableBinderRequestAsyncResult result2 = AsyncResult.End <ReliableBinderRequestAsyncResult>(result);

            handledException = result2.HandledException;
            return(result2.reply);
        }
        private IAsyncResult OnConnectionBeginSend(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException, AsyncCallback callback, object state)
        {
            if (attemptInfo.RetryCount > this.settings.MaxRetryCount)
            {
                this.session.OnLocalFault(new CommunicationException(System.ServiceModel.SR.GetString("MaximumRetryCountExceeded"), this.maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(this.session.OutputID), null);
                return(new CompletedAsyncResult(callback, state));
            }
            this.session.OnLocalActivity();
            this.AddAcknowledgementHeader(attemptInfo.Message, false);
            ReliableBinderRequestAsyncResult result = new ReliableBinderRequestAsyncResult(callback, state)
            {
                Binder             = this.binder,
                MessageAttemptInfo = attemptInfo,
                MaskingMode        = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None
            };

            if (attemptInfo.RetryCount < this.settings.MaxRetryCount)
            {
                result.MaskingMode         |= MaskingMode.Handled;
                result.SaveHandledException = false;
            }
            else
            {
                result.SaveHandledException = true;
            }
            result.Begin(timeout);
            return(result);
        }
        void EndSendAckRequestedMessage(IAsyncResult result)
        {
            Message reply = ReliableBinderRequestAsyncResult.End(result);

            if (reply != null)
            {
                this.ProcessReply(reply, null, 0);
            }
        }
        protected override void OnConnectionEndSendMessage(IAsyncResult result)
        {
            Message reply = ReliableBinderRequestAsyncResult.End(result);

            if (reply != null)
            {
                this.ProcessMessage(reply);
            }
        }
        protected override void OnConnectionEndSendMessage(IAsyncResult result)
        {
            Message message = ReliableBinderRequestAsyncResult.End(result);

            if (message != null)
            {
                base.ProcessMessage(message);
            }
        }
 protected override IAsyncResult OnConnectionBeginSendMessage(Message message, TimeSpan timeout, AsyncCallback callback, object state)
 {
     ReliableBinderRequestAsyncResult result = new ReliableBinderRequestAsyncResult(callback, state) {
         Binder = this.binder,
         MaskingMode = MaskingMode.Handled,
         Message = message
     };
     result.Begin(timeout);
     return result;
 }
        protected override IAsyncResult OnConnectionBeginSendMessage(Message message, TimeSpan timeout,
                                                                     AsyncCallback callback, object state)
        {
            ReliableBinderRequestAsyncResult requestResult = new ReliableBinderRequestAsyncResult(callback, state);

            requestResult.Binder      = this.binder;
            requestResult.MaskingMode = MaskingMode.Handled;
            requestResult.Message     = message;

            requestResult.Begin(timeout);
            return(requestResult);
        }
        IAsyncResult BeginSendAckRequestedMessage(TimeSpan timeout, MaskingMode maskingMode, AsyncCallback callback,
                                                  object state)
        {
            this.session.OnLocalActivity();
            ReliableBinderRequestAsyncResult requestResult = new ReliableBinderRequestAsyncResult(callback, state);

            requestResult.Binder      = this.binder;
            requestResult.MaskingMode = maskingMode;
            requestResult.Message     = this.CreateAckRequestedMessage();
            requestResult.Begin(timeout);

            return(requestResult);
        }
        protected override void OnConnectionEndSend(IAsyncResult result)
        {
            Exception exception;
            Message   message = ReliableBinderRequestAsyncResult.End(result, out exception);
            ReliableBinderRequestAsyncResult result2 = (ReliableBinderRequestAsyncResult)result;

            if (result2.MessageAttemptInfo.RetryCount == base.Settings.MaxRetryCount)
            {
                base.MaxRetryCountException = exception;
            }
            if (message != null)
            {
                base.ProcessMessage(message);
            }
        }
        protected override void OnConnectionEndSend(IAsyncResult result)
        {
            Exception handledException;
            Message   reply = ReliableBinderRequestAsyncResult.End(result, out handledException);
            ReliableBinderRequestAsyncResult requestResult = (ReliableBinderRequestAsyncResult)result;

            if (requestResult.MessageAttemptInfo.RetryCount == this.Settings.MaxRetryCount)
            {
                this.MaxRetryCountException = handledException;
            }

            if (reply != null)
            {
                ProcessMessage(reply);
            }
        }
 protected override IAsyncResult OnConnectionBeginSend(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException, AsyncCallback callback, object state)
 {
     ReliableBinderRequestAsyncResult result = new ReliableBinderRequestAsyncResult(callback, state) {
         Binder = this.binder,
         MessageAttemptInfo = attemptInfo,
         MaskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None
     };
     if (attemptInfo.RetryCount < base.Settings.MaxRetryCount)
     {
         result.MaskingMode |= MaskingMode.Handled;
         result.SaveHandledException = false;
     }
     else
     {
         result.SaveHandledException = true;
     }
     result.Begin(timeout);
     return result;
 }
 private void OnConnectionEndSend(IAsyncResult result)
 {
     if (result is CompletedAsyncResult)
     {
         CompletedAsyncResult.End(result);
     }
     else
     {
         Exception exception;
         Message   reply = ReliableBinderRequestAsyncResult.End(result, out exception);
         ReliableBinderRequestAsyncResult result2 = (ReliableBinderRequestAsyncResult)result;
         if (result2.MessageAttemptInfo.RetryCount == this.settings.MaxRetryCount)
         {
             this.maxRetryCountException = exception;
         }
         if (reply != null)
         {
             this.ProcessReply(reply, (IReliableRequest)result2.MessageAttemptInfo.State, result2.MessageAttemptInfo.GetSequenceNumber());
         }
     }
 }
        protected override IAsyncResult OnConnectionBeginSend(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException, AsyncCallback callback, object state)
        {
            ReliableBinderRequestAsyncResult result = new ReliableBinderRequestAsyncResult(callback, state)
            {
                Binder             = this.binder,
                MessageAttemptInfo = attemptInfo,
                MaskingMode        = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None
            };

            if (attemptInfo.RetryCount < base.Settings.MaxRetryCount)
            {
                result.MaskingMode         |= MaskingMode.Handled;
                result.SaveHandledException = false;
            }
            else
            {
                result.SaveHandledException = true;
            }
            result.Begin(timeout);
            return(result);
        }