Beispiel #1
0
        /// <summary>
        /// 启动Server
        /// </summary>
        /// <returns></returns>
        public bool StartHttpServer()
        {
            LoadConfig();
            LoadCometCommands();
            base.Start(_Config);
            if (_Config.HostList != null && _Config.HostList.Count > 0)
            {
                Console.WriteLine("=============These hosts are running:=============");
                foreach (string host in _Config.HostList)
                {
                    Console.WriteLine(host);
                }
                Console.WriteLine("--------------------------------------------------");
            }
            _ServerStatManager = new WebServer.Module.ServerStat.ServerStatManager();

            AutoResetEvent autoEvent = new AutoResetEvent(false);

            _tmWorkerCallback = new TimerCallback(this.StartWorkerProcessing);
            _tmWorker         = new Timer(_tmWorkerCallback, autoEvent, 1000, 5000);

            _tmStatSaverCallback = new TimerCallback(this.StartStatSaverProcessing);
            _tmStatSaver         = new Timer(_tmStatSaverCallback, autoEvent, 1000, 1000);

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// 启动Server
        /// </summary>
        /// <returns></returns>
        public bool StartHttpServer()
        {
            LoadConfig();
            LoadCometCommands();
            base.Start(_Config);
            if (_Config.HostList != null && _Config.HostList.Count > 0)
            {
                Console.WriteLine("=============These hosts are running:=============");
                foreach (string host in _Config.HostList)
                {
                    Console.WriteLine(host);
                }
                Console.WriteLine("--------------------------------------------------");
            }
            _ServerStatManager = new WebServer.Module.ServerStat.ServerStatManager();

            AutoResetEvent autoEvent = new AutoResetEvent(false);

            _tmWorkerCallback = new TimerCallback(this.StartWorkerProcessing);
            _tmWorker = new Timer(_tmWorkerCallback, autoEvent, 1000, 5000);

            _tmStatSaverCallback = new TimerCallback(this.StartStatSaverProcessing);
            _tmStatSaver = new Timer(_tmStatSaverCallback, autoEvent, 1000, 1000);

            return true;
        }