Commit d6b8c7da authored by Michał Kępień's avatar Michał Kępień

win32: fix service state reported during shutdown

When a Windows service receives a request to stop, it should not set its
state to SERVICE_STOPPED until it is completely shut down as doing that
allows the operating system to kill that service prematurely, which in
the case of named may e.g. prevent the PID file and/or the lock file
from being cleaned up.

Set service state to SERVICE_STOP_PENDING when named begins its shutdown
and only report the SERVICE_STOPPED state immediately before exiting.

(cherry picked from commit 964749df)
parent 00e59aca
......@@ -82,7 +82,7 @@ ServiceControl(DWORD dwCtrlCode) {
case SERVICE_CONTROL_STOP:
ns_server_flushonshutdown(ns_g_server, true);
isc_app_shutdown();
UpdateSCM(SERVICE_STOPPED);
UpdateSCM(SERVICE_STOP_PENDING);
break;
default:
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment