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

Diff of /innwebd/service.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 by sysadm, Fri Jul 2 11:35:17 2004 UTC Revision 1.8 by sysadm, Sat Feb 26 16:10:26 2005 UTC
# Line 1  Line 1 
1  /*******************************************************/  /*******************************************************/
2  /*                                                     */  /*                                                     */
3  /*  LeafOK Innd                                        */  /*  LeafOK Innbbsd                                     */
4  /*  Copyright (C) LeafOK.com, 2003-2004                */  /*  Copyright (C) LeafOK.com, 2003-2005                */
5  /*                                                     */  /*                                                     */
6  /*  Programmed by Leaf                                 */  /*  Programmed by Leaf                                 */
7  /*  E-mail:leaf@leafok.com  QQ:6049044                 */  /*  E-mail:leaflet@leafok.com  QQ:6049044              */
8  /*                                                     */  /*                                                     */
9  /*  http://bbs.leafok.com                              */  /*  http://bbs.leafok.com                              */
10  /*  http://bbs.leafok.net                              */  /*  http://bbs.leafok.net                              */
# Line 14  Line 14 
14    
15  #include "StdAfx.h"  #include "StdAfx.h"
16  #include ".\service.h"  #include ".\service.h"
17    #include ".\App_common.h"
18    
19  using namespace std;  using namespace std;
20    
21  service::service(void)  service::service(void)
22          :CNTService("Innd Service")  :CNTService(App_common::ServiceName)
23  {  {
24            this->m_iMajorVersion = App_common::Ver_Major;
25            this->m_iMinorVersion = App_common::Ver_Minor;
26  }  }
27    
28  service::~service(void)  service::~service(void)
# Line 28  service::~service(void) Line 31  service::~service(void)
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          if (this->ctrld.begin() == 0)          this->ctrld.InitThreadPool();
39          {  
40                  syslog << logfile::log_head << "Begin CONTROL ... OK" << endl;          while (this->m_bIsRunning)
         }  
         else  
41          {          {
42                  syslog << logfile::log_head << "Begin CONTROL ... Failed" << endl;                  if (this->ctrld.begin() == 0)
43          }                  {
44                            syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl;
45    
46                            this->ctrld.StartupChild();
47                            
48                            break;
49                    }
50                    syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl;
51    
52                    if (startup_err_count++ > 5)
53                    {
54                            this->m_bIsRunning = false;
55                            break;
56                    }
57    
58          this->ctrld.StartupChild();                  Sleep(1000 * 60 * 5);
59            }
60    
61          while (this->m_bIsRunning && this->ctrld.IsRunning())          while (this->m_bIsRunning && this->ctrld.IsRunning())
62          {          {
63          Sleep(100);              Sleep(100);
64      }      }
65    
66          this->ctrld.ShutdownChild();          this->ctrld.ShutdownChild();
67    
68          if (this->ctrld.end() == 0)          if (this->ctrld.end() == 0)
69          {          {
70                  syslog << logfile::log_head << "End CONTROL ... OK" << endl;                  syslog << logfile::log_head << "End CONTROLD ... OK" << endl;
71          }          }
72          else          else
73          {          {
74                  syslog << logfile::log_head << "End CONTROL ... Failed" << endl;                  syslog << logfile::log_head << "End CONTROLD ... Failed" << endl;
75          }          }
76    
77            this->ctrld.CleanupThreadPool();
78  }  }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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