Update of /cvs-repository/Zope/lib/python/nt_svcutils
In directory cvs.zope.org:/tmp/cvs-serv16208/lib/python/nt_svcutils

Modified Files:
      Tag: Zope-2_7-branch
        service.py 
Log Message:
After consulting with Mark Hammond, removed the explicit calls to SvcStop().

That method gets invoked automatically by the services framework when a
stop request is generated.  Calling it explicitly too caused the onStop()
method to get called multiple times.  At least ZRS's Service subclasses
have onStop() methods that can't be called multiple times without raising
exceptions (they shut things down, and stuff like sockets go away the
first time onStop() gets called).


=== Zope/lib/python/nt_svcutils/service.py 1.1.2.3 => 1.1.2.4 ===
--- Zope/lib/python/nt_svcutils/service.py:1.1.2.3      Wed Apr 13 21:47:48 2005
+++ Zope/lib/python/nt_svcutils/service.py      Tue Apr 19 11:46:37 2005
@@ -161,7 +161,7 @@
             # XXX why the test before the log message?
             if self.backoff_interval > BACKOFF_INITIAL_INTERVAL:
                 self.info("created process")
-            if not (self.run() and self.checkRestart()):            
+            if not (self.run() and self.checkRestart()):
                 break
 
         self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
@@ -206,7 +206,7 @@
             win32api.TerminateProcess(self.hZope, 3)
         self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
 
-        # Wait for the redirect thread - it should have died as the remote 
+        # Wait for the redirect thread - it should have died as the remote
         # process terminated.
         # As we are shutting down, we do the join with a little more care,
         # reporting progress as we wait (even though we never will <wink>)
@@ -234,7 +234,6 @@
                                                win32event.INFINITE)
         if rc == win32event.WAIT_OBJECT_0:
             # user sent a stop service request
-            self.SvcStop()
             keep_running = False
         elif rc == win32event.WAIT_OBJECT_0 + 1:
             # user did not send a service stop request, but
@@ -261,7 +260,6 @@
         # this was an abormal shutdown.
         if self.backoff_cumulative > BACKOFF_MAX:
             self.error("restarting too frequently; quit")
-            self.SvcStop()
             return False
         self.warning("sleep %s to avoid rapid restarts"
                      % self.backoff_interval)
@@ -276,7 +274,7 @@
         self.backoff_cumulative += self.backoff_interval
         self.backoff_interval *= 2
         return True
-        
+
     def createProcessCaptureIO(self, cmd):
         hInputRead, hInputWriteTemp = self.newPipe()
         hOutReadTemp, hOutWrite = self.newPipe()
@@ -302,7 +300,7 @@
         # problematic in general, but should work in the controlled
         # circumstances of a service process.
         create_flags = win32process.CREATE_NEW_CONSOLE
-        info = win32process.CreateProcess(None, cmd, None, None, True, 
+        info = win32process.CreateProcess(None, cmd, None, None, True,
                                           create_flags, None, None, si)
         # (NOTE: these really aren't necessary for Python - they are closed
         # as soon as they are collected)

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to