protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
 {
     ChainedBeginHandler handler = new ChainedBeginHandler(this.DummyBeginClose);
     ChainedEndHandler handler2 = new ChainedEndHandler(this.DummyEndClose);
     if ((this.transportManagerContainer != null) && !this.TransferTransportManagers())
     {
         handler = new ChainedBeginHandler(this.transportManagerContainer.BeginClose);
         handler2 = new ChainedEndHandler(this.transportManagerContainer.EndClose);
     }
     return new ChainedAsyncResult(timeout, callback, state, new ChainedBeginHandler(this.OnBeginClose), new ChainedEndHandler(this.OnEndClose), handler, handler2);
 }
 protected void Begin(ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
 {
     this.end1 = end1;
     this.begin2 = begin2;
     this.end2 = end2;
     IAsyncResult result = begin1(this.timeoutHelper.RemainingTime(), begin1Callback, this);
     if (result.CompletedSynchronously && this.Begin1Completed(result))
     {
         base.Complete(true);
     }
 }
                protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
                {
                    ChainedBeginHandler handler  = new ChainedBeginHandler(this.DummyBeginClose);
                    ChainedEndHandler   handler2 = new ChainedEndHandler(this.DummyEndClose);

                    if (this.upgrade != null)
                    {
                        handler  = new ChainedBeginHandler(this.upgrade.BeginClose);
                        handler2 = new ChainedEndHandler(this.upgrade.EndClose);
                    }
                    return(new ChainedAsyncResult(timeout, callback, state, handler, handler2, new ChainedBeginHandler(this.OnBeginClose), new ChainedEndHandler(this.OnEndClose)));
                }
 public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs) : base(timeout, callback, state)
 {
     this.collection = new List<ICommunicationObject>();
     for (int i = 0; i < objs.Length; i++)
     {
         if (objs[i] != null)
         {
             this.collection.Add(objs[i]);
         }
     }
     base.Begin(begin1, end1, new ChainedBeginHandler(this.BeginOpen), new ChainedEndHandler(this.EndOpen));
 }
        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            ChainedBeginHandler handler  = new ChainedBeginHandler(this.DummyBeginClose);
            ChainedEndHandler   handler2 = new ChainedEndHandler(this.DummyEndClose);

            if ((this.transportManagerContainer != null) && !this.TransferTransportManagers())
            {
                handler  = new ChainedBeginHandler(this.transportManagerContainer.BeginClose);
                handler2 = new ChainedEndHandler(this.transportManagerContainer.EndClose);
            }
            return(new ChainedAsyncResult(timeout, callback, state, new ChainedBeginHandler(this.OnBeginClose), new ChainedEndHandler(this.OnEndClose), handler, handler2));
        }
        protected void Begin(ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
        {
            this.end1   = end1;
            this.begin2 = begin2;
            this.end2   = end2;
            IAsyncResult result = begin1(this.timeoutHelper.RemainingTime(), begin1Callback, this);

            if (result.CompletedSynchronously && this.Begin1Completed(result))
            {
                base.Complete(true);
            }
        }
示例#7
0
            public CloseAsyncResult(UdpChannelBase <T> channel, ChainedBeginHandler baseBeginClose, ChainedEndHandler baseEndClose, TimeSpan timeout, AsyncCallback callback, object state)
                : base(callback, state)
            {
                this.channel        = channel;
                this.baseBeginClose = baseBeginClose;
                this.baseEndClose   = baseEndClose;
                this.timeoutHelper  = new TimeoutHelper(timeout);

                if (this.BeginCloseOutputChannel())
                {
                    this.Complete(true);
                }
            }
            protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
            {
                ChainedBeginHandler begin1 = DummyBeginClose;
                ChainedEndHandler   end1   = DummyEndClose;

                if (this.upgrade != null && !TransferUpgrade())
                {
                    begin1 = this.upgrade.BeginClose;
                    end1   = this.upgrade.EndClose;
                }

                return(new ChainedAsyncResult(timeout, callback, state, base.OnBeginClose, base.OnEndClose, begin1, end1));
            }
            protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
            {
                ChainedBeginHandler begin1 = DummyBeginClose;
                ChainedEndHandler   end1   = DummyEndClose;

                if (this.transportManagerContainer != null)
                {
                    begin1 = this.transportManagerContainer.BeginClose;
                    end1   = this.transportManagerContainer.EndClose;
                }

                return(new ChainedAsyncResult(timeout, callback, state, begin1, end1,
                                              base.OnBeginClose, base.OnEndClose));
            }
        protected void Begin(ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
        {
            _end1 = end1;
            _begin2 = begin2;
            _end2 = end2;

            IAsyncResult result = begin1(_timeoutHelper.RemainingTime(), s_begin1Callback, this);
            if (!result.CompletedSynchronously)
                return;

            if (Begin1Completed(result))
            {
                this.Complete(true);
            }
        }
示例#11
0
        protected void Begin(ChainedBeginHandler beginOne, ChainedEndHandler endOne, ChainedBeginHandler beginTwo, ChainedEndHandler endTwo)
        {
            this.end1   = endOne;
            this.begin2 = beginTwo;
            this.end2   = endTwo;
            IAsyncResult asyncResult = beginOne(this.timeoutHelper.RemainingTime(), ChainedAsyncResult.begin1Callback, this);

            if (!asyncResult.CompletedSynchronously)
            {
                return;
            }
            if (this.Begin1Completed(asyncResult))
            {
                base.Complete(true);
            }
        }
示例#12
0
        protected void Begin(ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
        {
            _end1   = end1;
            _begin2 = begin2;
            _end2   = end2;

            IAsyncResult result = begin1(_timeoutHelper.RemainingTime(), s_begin1Callback, this);

            if (!result.CompletedSynchronously)
            {
                return;
            }

            if (Begin1Completed(result))
            {
                this.Complete(true);
            }
        }
示例#13
0
 public ChainedAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
     : base(callback, state)
 {
     this.timeoutHelper = new TimeoutHelper(timeout);
     Begin(begin1, end1, begin2, end2);
 }
示例#14
0
 public ChainedAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
     : base(callback, state)
 {
     _timeoutHelper = new TimeoutHelper(timeout);
     Begin(begin1, end1, begin2, end2);
 }
示例#15
0
        public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs)
            : base(timeout, callback, state)
        {
            _collection = new List <ICommunicationObject>();

            for (int index = 0; index < objs.Length; index++)
            {
                if (objs[index] != null)
                {
                    _collection.Add(objs[index]);
                }
            }

            Begin(begin1, end1, BeginOpen, EndOpen);
        }
示例#16
0
        public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList <ICommunicationObject> collection)
            : base(timeout, callback, state)
        {
            _collection = collection;

            Begin(begin1, end1, BeginOpen, EndOpen);
        }
示例#17
0
 public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs) : base(timeout, callback, state)
 {
     this.collection = new List <ICommunicationObject>();
     for (int i = 0; i < (int)objs.Length; i++)
     {
         if (objs[i] != null)
         {
             this.collection.Add(objs[i]);
         }
     }
     base.Begin(begin1, end1, new ChainedBeginHandler(this.BeginOpen), new ChainedEndHandler(this.EndOpen));
 }
        public ChainedCloseAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList<ICommunicationObject> collection)
            : base(timeout, callback, state)
        {
            this.collection = collection;

            Begin(BeginClose, EndClose, begin1, end1);
        }
        public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList<ICommunicationObject> collection)
            : base(timeout, callback, state)
        {
            _collection = collection;

            Begin(begin1, end1, BeginOpen, EndOpen);
        }
        public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs)
            : base(timeout, callback, state)
        {
            _collection = new List<ICommunicationObject>();

            for (int index = 0; index < objs.Length; index++)
                if (objs[index] != null)
                    _collection.Add(objs[index]);

            Begin(begin1, end1, BeginOpen, EndOpen);
        }
        public ChainedCloseAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList <ICommunicationObject> collection)
            : base(timeout, callback, state)
        {
            this.collection = collection;

            Begin(BeginClose, EndClose, begin1, end1);
        }