(service_main,main,shutdown) [_WIN32]: Add missing loc_NTTerm().
(service_main,main,shutdown,empth_exit,service_stopped) [_WIN32]: Add shutdown Event to allow the service to shutdown. When SERVICE_STOPPED is passed to SetServiceStatus() all threads are kills this prevents shutdown() from executing. The shutdown Event is used to block the service_main thread until the stopping of the service is started. After the shutdown() is complete then the SetServiceStatus() is called.
This commit is contained in:
parent
6c7f707b76
commit
014d005c69
3 changed files with 42 additions and 36 deletions
|
@ -218,7 +218,7 @@ main(int argc, char **argv)
|
|||
*/
|
||||
if (GetLastError() != ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
|
||||
logerror("Failed to dispatch service (%d)", GetLastError());
|
||||
printf("Failed to dispatch service (%d)\n", GetLastError());
|
||||
loc_NTTerm();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +488,14 @@ shutdwn(int sig)
|
|||
else
|
||||
logerror("Server shutting down at Deity's request");
|
||||
close_files();
|
||||
|
||||
#if defined(_WIN32)
|
||||
loc_NTTerm();
|
||||
if (!daemonize)
|
||||
_exit(0);
|
||||
#else
|
||||
_exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue