--- innwebd/service.cpp 2004/07/03 15:10:23 1.2 +++ innwebd/service.cpp 2004/09/16 15:42:06 1.6 @@ -1,10 +1,10 @@ /*******************************************************/ /* */ -/* LeafOK Innd */ +/* LeafOK Innbbsd */ /* Copyright (C) LeafOK.com, 2003-2004 */ /* */ /* Programmed by Leaf */ -/* E-mail:leaf@leafok.com QQ:6049044 */ +/* E-mail:leaflet@leafok.com QQ:6049044 */ /* */ /* http://bbs.leafok.com */ /* http://bbs.leafok.net */ @@ -14,12 +14,15 @@ #include "StdAfx.h" #include ".\service.h" +#include ".\App_common.h" using namespace std; service::service(void) - :CNTService("Innd Service") +:CNTService(App_common::ServiceName) { + this->m_iMajorVersion = App_common::Ver_Major; + this->m_iMinorVersion = App_common::Ver_Minor; } service::~service(void) @@ -28,35 +31,44 @@ service::~service(void) void service::Run() { + int startup_err_count = 0; + this->ctrld.StartupDelay(); this->ctrld.InitThreadPool(); - if (this->ctrld.begin() == 0) - { - syslog << logfile::log_head << "Begin CONTROL ... OK" << endl; - } - else + while (this->m_bIsRunning) { - syslog << logfile::log_head << "Begin CONTROL ... Failed" << endl; - } + if (this->ctrld.begin() == 0) + { + syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl; + + this->ctrld.StartupChild(); + + break; + } + syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl; + + if (startup_err_count++ > 5) + break; - this->ctrld.StartupChild(); + Sleep(1000 * 60 * 5); + } while (this->m_bIsRunning && this->ctrld.IsRunning()) { - Sleep(100); + Sleep(100); } this->ctrld.ShutdownChild(); if (this->ctrld.end() == 0) { - syslog << logfile::log_head << "End CONTROL ... OK" << endl; + syslog << logfile::log_head << "End CONTROLD ... OK" << endl; } else { - syslog << logfile::log_head << "End CONTROL ... Failed" << endl; + syslog << logfile::log_head << "End CONTROLD ... Failed" << endl; } this->ctrld.CleanupThreadPool();