예제 #1
0
        public virtual bool shouldDelay(string server)
        {
            if (OfflineStatus.isOffline(server))
            {
                log.Debug("Offline check: " + maybeOnline);

                if (maybeOnline <= 0)
                { //first time (1) we try anyway
                    return(true);
                }
                else
                {
                    maybeOnline--;
                    if (maybeOnline == 0)
                    {
                        int ph = this.maybePhase;

                        log.Debug("Offline check 0.");

                        //avoid to lock on the offline flag, once in MAYBE_ONLINE_TIMEOUT seconds reset the flag
                        thread.schedule(new Task(() =>
                        {
                            resetMaybeOnline(ph);
                        }), MAYBE_ONLINE_TIMEOUT);
                    }
                }
            }
            return(false);
        }
        private void startSwitchTimeout(string reason, long delay)
        {
            long timeout = this.options.SwitchCheckTimeout + delay; //we could add the delay from the slowing, but that will probably make things worse
                                                                    //we might take into account how much the connect timeout has been increased
            int ph = this.statusPhase;

            thread.schedule(new Task(() =>
            {
                switchTimeout(ph, reason);
            }), timeout);
        }