2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

daemon-windows: unlink pidfile before stopping the service.

When a OVS daemon is configured to run as a Windows service,
when the service is stopped by calling service_stop(), the
windows services manager does not give enough time to do
everything in the atexit handler. So call the exit handler
directly from service_stop().

Also add a test case for Windows services which checks for
the termination of the service by looking at pidfile cleaned
by the exit handler.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Gurucharan Shetty
2014-05-28 15:07:31 -07:00
parent 784acd821b
commit 02a514ef71
4 changed files with 34 additions and 4 deletions

View File

@@ -64,7 +64,6 @@ static volatile sig_atomic_t stored_sig_nr = SIG_ATOMIC_MAX;
static struct ovs_mutex mutex;
static void atexit_handler(void);
static void call_hooks(int sig_nr);
#ifdef _WIN32
static BOOL WINAPI ConsoleHandlerRoutine(DWORD dwCtrlType);
@@ -115,7 +114,7 @@ fatal_signal_init(void)
}
#endif
}
atexit(atexit_handler);
atexit(fatal_signal_atexit_handler);
}
}
@@ -226,8 +225,8 @@ fatal_ignore_sigpipe(void)
#endif
}
static void
atexit_handler(void)
void
fatal_signal_atexit_handler(void)
{
call_hooks(0);
}