/[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.9 by sysadm, Fri Apr 11 17:14:49 2008 UTC
# Line 1  Line 1 
1  /*******************************************************/  /*******************************************************/
2  /*                                                     */  /*                                                     */
3  /*  LeafOK Innd                                        */  /*  LeafOK Innbbsd                                     */
 /*  Copyright (C) LeafOK.com, 2003-2004                */  
4  /*                                                     */  /*                                                     */
5  /*  Programmed by Leaf                                 */  /*  Copyright (C) LeafOK.com, 2003-2008                */
 /*  E-mail:leaf@leafok.com  QQ:6049044                 */  
6  /*                                                     */  /*                                                     */
7  /*  http://bbs.leafok.com                              */  /*  http://www.leafok.com                              */
 /*  http://bbs.leafok.net                              */  
 /*  http://bbs.fenglin.info                            */  
8  /*                                                     */  /*                                                     */
9  /*******************************************************/  /*******************************************************/
10    
11  #include "StdAfx.h"  #include "StdAfx.h"
12  #include ".\service.h"  #include ".\service.h"
13    #include ".\App_common.h"
14    
15  using namespace std;  using namespace std;
16    
17  service::service(void)  service::service(void)
18          :CNTService("Innd Service")  :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)  service::~service(void)
# Line 28  service::~service(void) Line 27  service::~service(void)
27    
28  void service::Run()  void service::Run()
29  {  {
30            int startup_err_count = 0;
31    
32          this->ctrld.StartupDelay();          this->ctrld.StartupDelay();
33    
34          if (this->ctrld.begin() == 0)          this->ctrld.InitThreadPool();
35          {  
36                  syslog << logfile::log_head << "Begin CONTROL ... OK" << endl;          while (this->m_bIsRunning)
         }  
         else  
37          {          {
38                  syslog << logfile::log_head << "Begin CONTROL ... Failed" << endl;                  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          this->ctrld.StartupChild();                  Sleep(1000 * 60 * 5);
55            }
56    
57          while (this->m_bIsRunning && this->ctrld.IsRunning())          while (this->m_bIsRunning && this->ctrld.IsRunning())
58          {          {
59          Sleep(100);              Sleep(100);
60      }      }
61    
62          this->ctrld.ShutdownChild();          this->ctrld.ShutdownChild();
63    
64          if (this->ctrld.end() == 0)          if (this->ctrld.end() == 0)
65          {          {
66                  syslog << logfile::log_head << "End CONTROL ... OK" << endl;                  syslog << logfile::log_head << "End CONTROLD ... OK" << endl;
67          }          }
68          else          else
69          {          {
70                  syslog << logfile::log_head << "End CONTROL ... Failed" << endl;                  syslog << logfile::log_head << "End CONTROLD ... Failed" << endl;
71          }          }
72    
73            this->ctrld.CleanupThreadPool();
74  }  }


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

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