merge stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Tue, 30 Mar 2010 18:41:17 +0200
branchstable
changeset 5089 289cb1cebae8
parent 5087 192ebe969779 (current diff)
parent 5088 891cdb7d8cbb (diff)
child 5091 ae161c25a68e
merge
--- a/etwist/service.py	Tue Mar 30 17:59:18 2010 +0200
+++ b/etwist/service.py	Tue Mar 30 18:41:17 2010 +0200
@@ -17,7 +17,6 @@
 os.environ['CW_INSTANCES_DIR'] = r'C:\etc\cubicweb.d'
 os.environ['USERNAME'] = 'cubicweb'
 
-
 class CWService(object, win32serviceutil.ServiceFramework):
     _svc_name_ = None
     _svc_display_name_ = None
@@ -25,7 +24,6 @@
 
     def __init__(self, *args, **kwargs):
         win32serviceutil.ServiceFramework.__init__(self, *args, **kwargs)
-        self._stop_event = win32event.CreateEvent(None, 0, 0, None)
         cwcfg.load_cwctl_plugins()
         set_log_methods(CubicWebRootResource, logger)
         server.parsePOSTData = parsePOSTData
@@ -33,8 +31,8 @@
     def SvcStop(self):
         self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
         logger.info('stopping %s service' % self.instance)
-        win32event.SetEvent(self._stop_event)
-        self.ReportServiceStatus(win32service.SERVICE_STOPPED)
+        reactor.stop()
+        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
 
     def SvcDoRun(self):
         self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
@@ -57,5 +55,4 @@
         except Exception, e:
             logger.error('service %s stopped (cause: %s)' % (self.instance, e))
             logger.exception('what happened ...')
-            self.SvcStop()
-
+        self.ReportServiceStatus(win32service.SERVICE_STOPPED)