Delay report that the service is running.
authorIain Patterson <me@iain.cx>
Thu, 31 Oct 2013 13:22:02 +0000 (13:22 +0000)
committerIain Patterson <me@iain.cx>
Thu, 31 Oct 2013 13:23:21 +0000 (13:23 +0000)
Wait until the application has been running for long enough to be exempt
from restart throttling before reporting a status of SERVICE_RUNNING to
the operating system.

Thanks Tom Saul.

service.cpp

index 873b8a8..1e78c3c 100644 (file)
@@ -404,13 +404,13 @@ int start_service() {
 \r
   close_output_handles(&si);\r
 \r
+  /* Wait for a clean startup. */\r
+  if (WaitForSingleObject(process_handle, throttle_delay) == WAIT_TIMEOUT) throttle = 0;\r
+\r
   /* Signal successful start */\r
   service_status.dwCurrentState = SERVICE_RUNNING;\r
   SetServiceStatus(service_handle, &service_status);\r
 \r
-  /* Wait for a clean startup. */\r
-  if (WaitForSingleObject(process_handle, throttle_delay) == WAIT_TIMEOUT) throttle = 0;\r
-\r
   return 0;\r
 }\r
 \r