| 31 |
|
|
| 32 |
void service::Run() |
void service::Run() |
| 33 |
{ |
{ |
| 34 |
|
int startup_err_count = 0; |
| 35 |
|
|
| 36 |
this->ctrld.StartupDelay(); |
this->ctrld.StartupDelay(); |
| 37 |
|
|
| 38 |
this->ctrld.InitThreadPool(); |
this->ctrld.InitThreadPool(); |
| 39 |
|
|
| 40 |
if (this->ctrld.begin() == 0) |
while (this->m_bIsRunning) |
| 41 |
{ |
{ |
| 42 |
syslog << logfile::log_head << "Begin CONTROL ... OK" << endl; |
if (this->ctrld.begin() == 0) |
| 43 |
|
{ |
| 44 |
|
syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl; |
| 45 |
|
|
| 46 |
this->ctrld.StartupChild(); |
this->ctrld.StartupChild(); |
| 47 |
|
|
| 48 |
|
break; |
| 49 |
|
} |
| 50 |
|
syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl; |
| 51 |
|
|
| 52 |
while (this->m_bIsRunning && this->ctrld.IsRunning()) |
if (startup_err_count++ > 5) |
| 53 |
{ |
{ |
| 54 |
Sleep(100); |
this->m_bIsRunning = false; |
| 55 |
} |
break; |
| 56 |
|
} |
| 57 |
|
|
| 58 |
this->ctrld.ShutdownChild(); |
Sleep(1000 * 60 * 5); |
| 59 |
} |
} |
| 60 |
else |
|
| 61 |
|
while (this->m_bIsRunning && this->ctrld.IsRunning()) |
| 62 |
{ |
{ |
| 63 |
syslog << logfile::log_head << "Begin CONTROL ... Failed" << endl; |
Sleep(100); |
| 64 |
} |
} |
| 65 |
|
|
| 66 |
|
this->ctrld.ShutdownChild(); |
| 67 |
|
|
| 68 |
if (this->ctrld.end() == 0) |
if (this->ctrld.end() == 0) |
| 69 |
{ |
{ |