--- innwebd/service.cpp 2004/07/09 00:33:38 1.4 +++ innwebd/service.cpp 2008/04/11 17:14:49 1.9 @@ -1,14 +1,10 @@ /*******************************************************/ /* */ /* LeafOK Innbbsd */ -/* Copyright (C) LeafOK.com, 2003-2004 */ /* */ -/* Programmed by Leaf */ -/* E-mail:leaflet@leafok.com QQ:6049044 */ +/* Copyright (C) LeafOK.com, 2003-2008 */ /* */ -/* http://bbs.leafok.com */ -/* http://bbs.leafok.net */ -/* http://bbs.fenglin.info */ +/* http://www.leafok.com */ /* */ /*******************************************************/ @@ -31,27 +27,39 @@ service::~service(void) void service::Run() { + int startup_err_count = 0; + this->ctrld.StartupDelay(); this->ctrld.InitThreadPool(); - if (this->ctrld.begin() == 0) + while (this->m_bIsRunning) { - syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl; + if (this->ctrld.begin() == 0) + { + syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl; - this->ctrld.StartupChild(); + this->ctrld.StartupChild(); + + break; + } + syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl; - while (this->m_bIsRunning && this->ctrld.IsRunning()) + if (startup_err_count++ > 5) { - Sleep(100); - } + this->m_bIsRunning = false; + break; + } - this->ctrld.ShutdownChild(); + Sleep(1000 * 60 * 5); } - else + + while (this->m_bIsRunning && this->ctrld.IsRunning()) { - syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl; - } + Sleep(100); + } + + this->ctrld.ShutdownChild(); if (this->ctrld.end() == 0) {