コード例 #1
0
        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));
        }
            public CloseAsyncResult(ReliableChannelListenerBase <TChannel> parent, OperationWithTimeoutBeginCallback baseBeginClose, OperationEndCallback baseEndClose, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
            {
                this.parent         = parent;
                this.baseBeginClose = baseBeginClose;
                this.baseEndClose   = baseEndClose;
                bool flag = false;

                if (this.parent.ShouldCloseOnChannelListenerClose())
                {
                    this.timeoutHelper = new TimeoutHelper(timeout);
                    IAsyncResult result = this.parent.BeginCloseInnerListener(this.timeoutHelper.RemainingTime(), ReliableChannelListenerBase <TChannel> .CloseAsyncResult.onInnerChannelListenerCloseComplete, this);
                    if (result.CompletedSynchronously)
                    {
                        flag = this.CompleteInnerChannelListenerClose(result);
                    }
                }
                else
                {
                    flag = this.CloseBaseChannelListener(timeout);
                }
                if (flag)
                {
                    base.Complete(true);
                }
            }
 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));
        }
コード例 #5
0
        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));
        }
 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);
 }
コード例 #7
0
        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));
        }
 internal ComposedAsyncResult(TimeSpan timeout, OperationWithTimeoutBeginCallback[] beginOperations, OperationEndCallback[] endOperations, AsyncCallback callback, object state) : base(callback, state)
 {
     this.completedSynchronously = true;
     this.timeoutHelper = new TimeoutHelper(timeout);
     this.beginOperations = beginOperations;
     this.endOperations = endOperations;
     this.SkipToNextOperation();
     if (this.currentOperation < this.beginOperations.Length)
     {
         this.beginOperations[this.currentOperation](this.RemainingTime(), onOperationCompleted, this);
     }
     else
     {
         base.Complete(this.completedSynchronously);
     }
 }
        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            bool wsrm11 = this.settings.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;

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

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

            return(new ReliableChannelCloseAsyncResult(beginCallbacks, endCallbacks, this.binder,
                                                       timeout, 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));
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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);
        }
 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);
 }
 public static IAsyncResult BeginComposeAsyncOperations(TimeSpan timeout, OperationWithTimeoutBeginCallback[] beginOperations, OperationEndCallback[] endOperations, AsyncCallback callback, object state)
 {
     return new ComposedAsyncResult(timeout, beginOperations, endOperations, callback, state);
 }
 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));
 }