Beispiel #1
0
        private RouterBase GetRouter(RouterType routerType)
        {
            RouterBase router = this.routerDic[routerType];

            Trace.WriteLine(router != null, "Selected router can't be null!");
            return(router);
        }
Beispiel #2
0
        public bool Reconnect(DetectionParamsItem detectionItem)
        {
            if ((null != detectionItem) && (detectionItem.ReconnectType == ReconnectType.Router))
            {
                RouterItem routerItem = detectionItem.Router;
                LogManager.Info(string.Format("start restart router:{0}", routerItem.IP));
                RouterBase router = this.GetRouter(routerItem.RouterType);
                router.Reconnect(routerItem);
                ReconnectManager.Sleep();

                int i = 0;
                while (i++ < ReconnectManager.TRYCOUNT)
                {
                    if (CmdHelper.PingBaidu() || CmdHelper.Ping163())
                    {
                        return(true);
                    }
                    Thread.Sleep(2 * 1000);
                }
                return(false);
            }

            return(false);
        }