char flags[CMD_LENGTH];\r
char dir[MAX_PATH];\r
bool stopping;\r
+bool allow_restart;\r
unsigned long throttle_delay;\r
unsigned long stop_method;\r
HANDLE throttle_timer;\r
/* Start the service */\r
int start_service() {\r
stopping = false;\r
+ allow_restart = true;\r
\r
if (process_handle) return 0;\r
\r
\r
/* Stop the service */\r
int stop_service(unsigned long exitcode, bool graceful, bool default_action) {\r
+ allow_restart = false;\r
+ if (wait_handle) UnregisterWait(wait_handle);\r
+\r
if (default_action && ! exitcode && ! graceful) {\r
log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_GRACEFUL_SUICIDE, service_name, exe, exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_REALLY] ,0);\r
graceful = true;\r
this is a controlled shutdown, and don't take any restart action.\r
*/\r
if (why) return;\r
+ if (! allow_restart) return;\r
\r
/* What action should we take? */\r
int action = NSSM_EXIT_RESTART;\r