From c50225935f0143fbe5fb37d906aa7e6e68f81040 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Thu, 31 Oct 2013 13:22:02 +0000 Subject: [PATCH] Delay report that the service is running. 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service.cpp b/service.cpp index 873b8a8..1e78c3c 100644 --- a/service.cpp +++ b/service.cpp @@ -404,13 +404,13 @@ int start_service() { close_output_handles(&si); + /* Wait for a clean startup. */ + if (WaitForSingleObject(process_handle, throttle_delay) == WAIT_TIMEOUT) throttle = 0; + /* Signal successful start */ service_status.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(service_handle, &service_status); - /* Wait for a clean startup. */ - if (WaitForSingleObject(process_handle, throttle_delay) == WAIT_TIMEOUT) throttle = 0; - return 0; } -- 2.7.4