X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=service.cpp;h=596aa7e4fcabfd902074ab0bd344675e323516d8;hb=a9269d8370b339777c32e6e4a5e5be3ad7387a1c;hp=d8dd1aa33d35cc6acac0a456d4491ab79661a43d;hpb=64eea0aef7d23dc4cfdaa7d979473c629f41ab85;p=nssm.git diff --git a/service.cpp b/service.cpp index d8dd1aa..596aa7e 100644 --- a/service.cpp +++ b/service.cpp @@ -445,7 +445,10 @@ int stop_service(unsigned long exitcode, bool graceful, bool default_action) { /* Signal we are stopping */ if (graceful) { service_status.dwCurrentState = SERVICE_STOP_PENDING; - service_status.dwWaitHint = NSSM_KILL_WINDOW_GRACE_PERIOD + NSSM_KILL_THREADS_GRACE_PERIOD + NSSM_WAITHINT_MARGIN; + service_status.dwWaitHint = NSSM_WAITHINT_MARGIN; + if (stop_method & NSSM_STOP_METHOD_CONSOLE && imports.AttachConsole) service_status.dwWaitHint += NSSM_KILL_CONSOLE_GRACE_PERIOD; + if (stop_method & NSSM_STOP_METHOD_WINDOW) service_status.dwWaitHint += NSSM_KILL_WINDOW_GRACE_PERIOD; + if (stop_method & NSSM_STOP_METHOD_THREADS) service_status.dwWaitHint += NSSM_KILL_THREADS_GRACE_PERIOD; SetServiceStatus(service_handle, &service_status); }