2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 15:45:25 +00:00

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.
This commit is contained in:
Michał Kępień
2019-04-19 09:37:51 +02:00
parent 1a9be94f83
commit 964749dfdb

View File

@@ -81,7 +81,7 @@ ServiceControl(DWORD dwCtrlCode) {
case SERVICE_CONTROL_STOP:
named_server_flushonshutdown(named_g_server, true);
isc_app_shutdown();
UpdateSCM(SERVICE_STOPPED);
UpdateSCM(SERVICE_STOP_PENDING);
break;
default:
break;