mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
parent
8880330c41
commit
561f0e2f4f
25
edge.c
25
edge.c
|
@ -558,7 +558,12 @@ static void daemonize() {
|
|||
|
||||
static int keep_on_running;
|
||||
|
||||
static void term_handler(int sig) {
|
||||
#ifdef WIN32
|
||||
BOOL WINAPI term_handler(DWORD sig)
|
||||
#else
|
||||
static void term_handler(int sig)
|
||||
#endif
|
||||
{
|
||||
static int called = 0;
|
||||
|
||||
if(called) {
|
||||
|
@ -570,22 +575,10 @@ static void term_handler(int sig) {
|
|||
}
|
||||
|
||||
keep_on_running = 0;
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType) {
|
||||
if(fdwCtrlType == CTRL_C_EVENT) {
|
||||
term_handler(0);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
|
||||
|
@ -703,7 +696,7 @@ int main(int argc, char* argv[]) {
|
|||
signal(SIGINT, term_handler);
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
SetConsoleCtrlHandler(CtrlHandler, TRUE);
|
||||
SetConsoleCtrlHandler(term_handler, TRUE);
|
||||
#endif
|
||||
|
||||
keep_on_running = 1;
|
||||
|
|
16
sn.c
16
sn.c
|
@ -944,9 +944,12 @@ static void dump_registrations(int signo) {
|
|||
|
||||
static int keep_running;
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
static void term_handler(int sig) {
|
||||
#ifdef WIN32
|
||||
BOOL WINAPI term_handler(DWORD sig)
|
||||
#else
|
||||
static void term_handler(int sig)
|
||||
#endif
|
||||
{
|
||||
static int called = 0;
|
||||
|
||||
if(called) {
|
||||
|
@ -958,8 +961,10 @@ static void term_handler(int sig) {
|
|||
}
|
||||
|
||||
keep_running = 0;
|
||||
}
|
||||
#ifdef WIN32
|
||||
return(TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
|
||||
|
@ -1022,6 +1027,9 @@ int main(int argc, char * const argv[]) {
|
|||
signal(SIGINT, term_handler);
|
||||
signal(SIGHUP, dump_registrations);
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
SetConsoleCtrlHandler(term_handler, TRUE);
|
||||
#endif
|
||||
|
||||
keep_running = 1;
|
||||
return run_loop(&sss_node);
|
||||
|
|
Loading…
Reference in New Issue
Block a user