You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2013/01/09 11:51:32 UTC

svn commit: r1430777 - in /commons/proper/daemon/branches/1.0.x: RELEASE-NOTES.txt src/native/windows/apps/prunsrv/prunsrv.c

Author: mturk
Date: Wed Jan  9 10:51:31 2013
New Revision: 1430777

URL: http://svn.apache.org/viewvc?rev=1430777&view=rev
Log:
DAEMON-274: Make sure shutdown works

Modified:
    commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt
    commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c

Modified: commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt?rev=1430777&r1=1430776&r2=1430777&view=diff
==============================================================================
--- commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt (original)
+++ commons/proper/daemon/branches/1.0.x/RELEASE-NOTES.txt Wed Jan  9 10:51:31 2013
@@ -84,7 +84,7 @@ NEW FEATURES:
 
 BUG FIXES:
 
-1.0.12: DAEMON-268
+1.0.12: DAEMON-268, DAEMON-274
 
 1.0.11: DAEMON-244, DAEMON-246, DAEMON-247, DAEMON-252, DAEMON-253, DAEMON-254,
         DAEMON-255, DAEMON-257, DAEMON-261, DAEMON-263, DAEMON-265, DAEMON-266,

Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c?rev=1430777&r1=1430776&r2=1430777&view=diff
==============================================================================
--- commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c (original)
+++ commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c Wed Jan  9 10:51:31 2013
@@ -832,22 +832,22 @@ static BOOL docmdUpdateService(LPAPXCMDL
 
 /* Report the service status to the SCM, including service specific exit code
  */
-int reportServiceStatusE(DWORD dwCurrentState,
-                        DWORD dwWin32ExitCode,
-                         DWORD dwWaitHint,
-                         DWORD dwServiceSpecificExitCode)
+static BOOL reportServiceStatusE(DWORD dwCurrentState,
+                                 DWORD dwWin32ExitCode,
+                                 DWORD dwWaitHint,
+                                 DWORD dwServiceSpecificExitCode)
 {
    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;
 
-   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatus: %d, %d, %d, %d",
+   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatusE: %d, %d, %d, %d",
                dwCurrentState, dwWin32ExitCode, dwWaitHint, dwServiceSpecificExitCode);
 
    if (_service_mode && _service_status_handle) {
-       if (dwCurrentState == SERVICE_START_PENDING)
-            _service_status.dwControlsAccepted = 0;
+       if (dwCurrentState == SERVICE_RUNNING)
+            _service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
         else
-            _service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
+            _service_status.dwControlsAccepted = 0;
 
        _service_status.dwCurrentState  = dwCurrentState;
        _service_status.dwWin32ExitCode = dwWin32ExitCode;
@@ -862,6 +862,7 @@ int reportServiceStatusE(DWORD dwCurrent
        fResult = SetServiceStatus(_service_status_handle, &_service_status);
        if (!fResult) {
            /* TODO: Deal with error */
+           apxLogWrite(APXLOG_MARK_ERROR "Failed to set service status");
        }
    }
    return fResult;
@@ -869,15 +870,16 @@ int reportServiceStatusE(DWORD dwCurrent
 
 /* Report the service status to the SCM
  */
-int reportServiceStatus(DWORD dwCurrentState,
-                        DWORD dwWin32ExitCode,
-                        DWORD dwWaitHint)
+static BOOL reportServiceStatus(DWORD dwCurrentState,
+                                DWORD dwWin32ExitCode,
+                                DWORD dwWaitHint)
 {
     return reportServiceStatusE(dwCurrentState, dwWin32ExitCode, dwWaitHint, 0);
 }
 
-int reportServiceStatusStopped(DWORD exitCode) {
-    if(exitCode) {
+static BOOL reportServiceStatusStopped(DWORD exitCode)
+{
+    if (exitCode) {
         return reportServiceStatusE(SERVICE_STOPPED, ERROR_SERVICE_SPECIFIC_ERROR, 0, exitCode);
     } else {
         return reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
@@ -1369,8 +1371,7 @@ void WINAPI serviceMain(DWORD argc, LPTS
     DWORD rc = 0;
     _service_status.dwServiceType      = SERVICE_WIN32_OWN_PROCESS;
     _service_status.dwCurrentState     = SERVICE_START_PENDING;
-    _service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP |
-                                         SERVICE_ACCEPT_PAUSE_CONTINUE;
+    _service_status.dwControlsAccepted = SERVICE_CONTROL_INTERROGATE;
     _service_status.dwWin32ExitCode    = 0;
     _service_status.dwCheckPoint       = 0;
     _service_status.dwWaitHint         = 0;