/[LeafOK_CVS]/innwebd/service.cpp
ViewVC logotype

Contents of /innwebd/service.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations)
Fri Apr 11 17:14:49 2008 UTC (17 years, 11 months ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +2 -6 lines
Content type: text/x-c++src
Error occurred while calculating annotation data.
Update copyright
Add extra log for exception

1 /*******************************************************/
2 /* */
3 /* LeafOK Innbbsd */
4 /* */
5 /* Copyright (C) LeafOK.com, 2003-2008 */
6 /* */
7 /* http://www.leafok.com */
8 /* */
9 /*******************************************************/
10
11 #include "StdAfx.h"
12 #include ".\service.h"
13 #include ".\App_common.h"
14
15 using namespace std;
16
17 service::service(void)
18 :CNTService(App_common::ServiceName)
19 {
20 this->m_iMajorVersion = App_common::Ver_Major;
21 this->m_iMinorVersion = App_common::Ver_Minor;
22 }
23
24 service::~service(void)
25 {
26 }
27
28 void service::Run()
29 {
30 int startup_err_count = 0;
31
32 this->ctrld.StartupDelay();
33
34 this->ctrld.InitThreadPool();
35
36 while (this->m_bIsRunning)
37 {
38 if (this->ctrld.begin() == 0)
39 {
40 syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl;
41
42 this->ctrld.StartupChild();
43
44 break;
45 }
46 syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl;
47
48 if (startup_err_count++ > 5)
49 {
50 this->m_bIsRunning = false;
51 break;
52 }
53
54 Sleep(1000 * 60 * 5);
55 }
56
57 while (this->m_bIsRunning && this->ctrld.IsRunning())
58 {
59 Sleep(100);
60 }
61
62 this->ctrld.ShutdownChild();
63
64 if (this->ctrld.end() == 0)
65 {
66 syslog << logfile::log_head << "End CONTROLD ... OK" << endl;
67 }
68 else
69 {
70 syslog << logfile::log_head << "End CONTROLD ... Failed" << endl;
71 }
72
73 this->ctrld.CleanupThreadPool();
74 }

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1