]> granicus.if.org Git - apache/commitdiff
Pick up earlier SHUTDOWN notification
authorWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 15 May 2009 18:03:44 +0000 (18:03 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 15 May 2009 18:03:44 +0000 (18:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@775266 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/service.c

index 2231b06b49f1b0cdb56882b41ff599391a2f48fa..84c35cc44a69428512fe9e3bb0dd11662626e1f2 100644 (file)
@@ -254,9 +254,10 @@ static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint)
     if (globdat.hServiceStatus)
     {
         if (currentState == SERVICE_RUNNING) {
-            globdat.ssStatus.dwWaitHint = 0;
-            globdat.ssStatus.dwCheckPoint = 0;
-            globdat.ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
+            ctx->ssStatus.dwWaitHint = 0;
+            ctx->ssStatus.dwCheckPoint = 0;
+            ctx->ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP
+                                             | SERVICE_ACCEPT_SHUTDOWN;
         }
         else if (currentState == SERVICE_STOPPED) {
             globdat.ssStatus.dwWaitHint = 0;
@@ -331,7 +332,9 @@ static void set_service_description(void)
 
 static VOID WINAPI service_nt_ctrl(DWORD dwCtrlCode)
 {
-    if (dwCtrlCode == SERVICE_CONTROL_STOP)
+    /* SHUTDOWN is offered before STOP, accept the first opportunity */
+    if ((dwCtrlCode == SERVICE_CONTROL_STOP)
+         || (dwCtrlCode == SERVICE_CONTROL_SHUTDOWN))
     {
         ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
         ReportStatusToSCMgr(SERVICE_STOP_PENDING, NO_ERROR, 30000);