public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            bool completeTransfer = false;

            lock (this.ThisLock)
            {
                completeTransfer = !this.closed;
                this.closed      = true;
            }

            OperationWithTimeoutBeginCallback[] beginCallbacks;
            OperationEndCallback[] endCallbacks;

            beginCallbacks = new OperationWithTimeoutBeginCallback[] {
                completeTransfer ? this.BeginCompleteTransfer : default(OperationWithTimeoutBeginCallback),
                this.shutdownHandle.BeginWait,
                this.sendGuard.BeginClose,
                this.beginSendAckRequestedHandler
            };

            endCallbacks = new OperationEndCallback[] {
                completeTransfer ? this.EndCompleteTransfer : default(OperationEndCallback),
                this.shutdownHandle.EndWait,
                this.sendGuard.EndClose,
                this.endSendAckRequestedHandler
            };

            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginCallbacks, endCallbacks, callback, state));
        }
 protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
 {
     this.ThrowIfCloseInvalid();
     OperationWithTimeoutBeginCallback[] beginOperations = new OperationWithTimeoutBeginCallback[] { new OperationWithTimeoutBeginCallback(this.connection.BeginClose), new OperationWithTimeoutBeginCallback(this.session.BeginClose), new OperationWithTimeoutBeginCallback(this.BeginCloseGuards), new OperationWithTimeoutBeginCallback(this.BeginCloseBinder), new OperationWithTimeoutBeginCallback(this.BeginUnregisterChannel), new OperationWithTimeoutBeginCallback(this.OnBeginClose) };
     OperationEndCallback[] endOperations = new OperationEndCallback[] { new OperationEndCallback(this.connection.EndClose), new OperationEndCallback(this.session.EndClose), new OperationEndCallback(this.EndCloseGuards), new OperationEndCallback(this.EndCloseBinder), new OperationEndCallback(this.EndUnregisterChannel), new OperationEndCallback(this.OnEndClose) };
     return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginOperations, endOperations, callback, state));
 }
        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            bool flag = this.settings.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;

            OperationWithTimeoutBeginCallback[] beginOperations = new OperationWithTimeoutBeginCallback[] { new OperationWithTimeoutBeginCallback(this.connection.BeginClose), new OperationWithTimeoutBeginCallback(this.BeginWaitForShutdown), flag ? new OperationWithTimeoutBeginCallback(this.BeginCloseSequence) : null, new OperationWithTimeoutBeginCallback(this.BeginTerminateSequence), new OperationWithTimeoutBeginCallback(this.session.BeginClose), new OperationWithTimeoutBeginCallback(this.BeginCloseBinder) };
            OperationEndCallback[] endOperations = new OperationEndCallback[] { new OperationEndCallback(this.connection.EndClose), new OperationEndCallback(this.EndWaitForShutdown), flag ? new OperationEndCallback(this.EndCloseSequence) : null, new OperationEndCallback(this.EndTerminateSequence), new OperationEndCallback(this.session.EndClose), new OperationEndCallback(this.EndCloseBinder) };
            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginOperations, endOperations, callback, state));
        }
        public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            OperationWithTimeoutBeginCallback[] beginCallbacks
                = new OperationWithTimeoutBeginCallback[] { shutdownWaitObject.BeginWait, terminateWaitObject.BeginWait };
            OperationEndCallback[] endCallbacks
                = new OperationEndCallback[] { shutdownWaitObject.EndWait, terminateWaitObject.EndWait };

            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginCallbacks, endCallbacks, callback, state));
        }
 private bool CompleteComposeAsyncOperations(IAsyncResult result)
 {
     OperationWithTimeoutComposer.EndComposeAsyncOperations(result);
     result = this.binder.BeginClose(this.timeoutHelper.RemainingTime(), MaskingMode.Handled, onBinderCloseComplete, this);
     if (result.CompletedSynchronously)
     {
         this.binder.EndClose(result);
         return(true);
     }
     return(false);
 }
        public ReliableChannelCloseAsyncResult(OperationWithTimeoutBeginCallback[] beginCallbacks, OperationEndCallback[] endCallbacks, IReliableChannelBinder binder, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
        {
            this.binder        = binder;
            this.timeoutHelper = new TimeoutHelper(timeout);
            IAsyncResult result = OperationWithTimeoutComposer.BeginComposeAsyncOperations(this.timeoutHelper.RemainingTime(), beginCallbacks, endCallbacks, onComposeAsyncOperationsComplete, this);

            if (result.CompletedSynchronously && this.CompleteComposeAsyncOperations(result))
            {
                base.Complete(true);
            }
        }
        public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            bool flag = false;

            lock (this.ThisLock)
            {
                flag        = !this.closed;
                this.closed = true;
            }
            OperationWithTimeoutBeginCallback[] beginOperations = new OperationWithTimeoutBeginCallback[] { flag ? new OperationWithTimeoutBeginCallback(this.BeginCompleteTransfer) : null, new OperationWithTimeoutBeginCallback(this.shutdownHandle.BeginWait), new OperationWithTimeoutBeginCallback(this.sendGuard.BeginClose), this.beginSendAckRequestedHandler };
            OperationEndCallback[] endOperations = new OperationEndCallback[] { flag ? new OperationEndCallback(this.EndCompleteTransfer) : null, new OperationEndCallback(this.shutdownHandle.EndWait), new OperationEndCallback(this.sendGuard.EndClose), this.endSendAckRequestedHandler };
            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginOperations, endOperations, callback, state));
        }
        protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
        {
            OperationWithTimeoutBeginCallback[] beginOperations = new OperationWithTimeoutBeginCallback[2];
            beginOperations[0] = new OperationWithTimeoutBeginCallback(this.OnBeginOpen);
            IChannelListener innerChannelListener = this.InnerChannelListener;

            beginOperations[1] = new OperationWithTimeoutBeginCallback(innerChannelListener.BeginOpen);
            OperationEndCallback[] endOperations = new OperationEndCallback[2];
            endOperations[0] = new OperationEndCallback(this.OnEndOpen);
            IChannelListener listener2 = this.InnerChannelListener;

            endOperations[1] = new OperationEndCallback(listener2.EndOpen);
            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginOperations, endOperations, callback, state));
        }
        protected virtual IAsyncResult BeginCloseInnerListener(TimeSpan timeout, AsyncCallback callback, object state)
        {
            OperationWithTimeoutBeginCallback[] callbackArray3 = new OperationWithTimeoutBeginCallback[2];
            callbackArray3[0] = new OperationWithTimeoutBeginCallback(this.faultHelper.BeginClose);
            IChannelListener innerChannelListener = this.InnerChannelListener;

            callbackArray3[1] = new OperationWithTimeoutBeginCallback(innerChannelListener.BeginClose);
            OperationWithTimeoutBeginCallback[] beginOperations = callbackArray3;
            OperationEndCallback[] callbackArray4 = new OperationEndCallback[2];
            callbackArray4[0] = new OperationEndCallback(this.faultHelper.EndClose);
            IChannelListener listener2 = this.InnerChannelListener;

            callbackArray4[1] = new OperationEndCallback(listener2.EndClose);
            OperationEndCallback[] endOperations = callbackArray4;
            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginOperations, endOperations, callback, state));
        }
Exemple #10
0
        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            List <OperationWithTimeoutBeginCallback> timeoutBeginCallbackList = new List <OperationWithTimeoutBeginCallback>();
            List <OperationEndCallback> operationEndCallbackList = new List <OperationEndCallback>();

            timeoutBeginCallbackList.Add(new OperationWithTimeoutBeginCallback(base.OnBeginClose));
            operationEndCallbackList.Add(new OperationEndCallback(base.OnEndClose));
            if (this.securityProtocolFactory != null && !this.SessionMode)
            {
                timeoutBeginCallbackList.Add(new OperationWithTimeoutBeginCallback(this.securityProtocolFactory.BeginClose));
                operationEndCallbackList.Add(new OperationEndCallback(this.securityProtocolFactory.EndClose));
            }
            if (this.sessionClientSettings != null)
            {
                timeoutBeginCallbackList.Add(new OperationWithTimeoutBeginCallback(this.sessionClientSettings.BeginClose));
                operationEndCallbackList.Add(new OperationEndCallback(this.sessionClientSettings.EndClose));
            }
            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, timeoutBeginCallbackList.ToArray(), operationEndCallbackList.ToArray(), callback, state));
        }
 protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
 {
     // Closing base first to close channels.  Must close higher channels before closing lower channels.
     return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(
                timeout,
                new OperationWithTimeoutBeginCallback[]
     {
         new OperationWithTimeoutBeginCallback(base.OnBeginClose),
         new OperationWithTimeoutBeginCallback(this.faultHelper.BeginClose),
         new OperationWithTimeoutBeginCallback(this.innerChannelFactory.BeginClose)
     },
                new OperationEndCallback[]
     {
         new OperationEndCallback(base.OnEndClose),
         new OperationEndCallback(this.faultHelper.EndClose),
         new OperationEndCallback(this.innerChannelFactory.EndClose)
     },
                callback,
                state));
 }
        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            bool wsrm11 = this.settings.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;

            OperationWithTimeoutBeginCallback[] beginCallbacks = new OperationWithTimeoutBeginCallback[] {
                this.connection.BeginClose,
                this.BeginWaitForShutdown,
                wsrm11 ? this.BeginCloseSequence : default(OperationWithTimeoutBeginCallback),
                this.BeginTerminateSequence,
                this.session.BeginClose,
                this.BeginCloseBinder
            };

            OperationEndCallback[] endCallbacks = new OperationEndCallback[] {
                this.connection.EndClose,
                this.EndWaitForShutdown,
                wsrm11 ? this.EndCloseSequence : default(OperationEndCallback),
                this.EndTerminateSequence,
                this.session.EndClose,
                this.EndCloseBinder
            };

            return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginCallbacks, endCallbacks, callback, state));
        }
 public void EndClose(IAsyncResult result)
 {
     OperationWithTimeoutComposer.EndComposeAsyncOperations(result);
     this.strategy.Close();
 }
 protected override Message OnEndRequest(bool last, IAsyncResult result)
 {
     OperationWithTimeoutComposer.EndComposeAsyncOperations(result);
     return(this.GetReply(last));
 }
 protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
 {
     OperationWithTimeoutBeginCallback[] beginOperations = new OperationWithTimeoutBeginCallback[] { new OperationWithTimeoutBeginCallback(this.OnBeginClose), new OperationWithTimeoutBeginCallback(this.BeginUnregisterChannel) };
     OperationEndCallback[] endOperations = new OperationEndCallback[] { new OperationEndCallback(this.OnEndClose), new OperationEndCallback(this.EndUnregisterChannel) };
     return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, beginOperations, endOperations, callback, state));
 }
Exemple #16
0
 protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
 {
     return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, new OperationWithTimeoutBeginCallback[] { new OperationWithTimeoutBeginCallback(this.OnBeginClose), new OperationWithTimeoutBeginCallback(this.faultHelper.BeginClose), new OperationWithTimeoutBeginCallback(this.innerChannelFactory.BeginClose) }, new OperationEndCallback[] { new OperationEndCallback(this.OnEndClose), new OperationEndCallback(this.faultHelper.EndClose), new OperationEndCallback(this.innerChannelFactory.EndClose) }, callback, state));
 }
 protected virtual void EndCloseInnerListener(IAsyncResult result)
 {
     OperationWithTimeoutComposer.EndComposeAsyncOperations(result);
 }
 protected override void OnEndClose(IAsyncResult result)
 {
     OperationWithTimeoutComposer.EndComposeAsyncOperations(result);
 }
 protected override IAsyncResult OnBeginRequest(Message request, TimeSpan timeout, AsyncCallback callback, object state)
 {
     this.request = request;
     return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, new OperationWithTimeoutBeginCallback[] { new OperationWithTimeoutBeginCallback(this.BeginSend), new OperationWithTimeoutBeginCallback(this.BeginWait) }, new OperationEndCallback[] { new OperationEndCallback(this.EndSend), new OperationEndCallback(this.EndWait) }, callback, state));
 }