--- innwebd/service.cpp 2004/07/04 06:45:23 1.3 +++ innwebd/service.cpp 2005/02/08 05:54:13 1.7 @@ -31,27 +31,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 CONTROL ... 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 CONTROL ... Failed" << endl; - } + Sleep(100); + } + + this->ctrld.ShutdownChild(); if (this->ctrld.end() == 0) {