diff --git a/src/or/control.c b/src/or/control.c index bb1c3307af..9f7739a402 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1222,7 +1222,8 @@ handle_control_signal(control_connection_t *conn, uint32_t len, /* Flush the "done" first if the signal might make us shut down. */ if (sig == SIGTERM || sig == SIGINT) connection_handle_write(TO_CONN(conn), 1); - signal_callback(0,0,(void*)(uintptr_t)sig); + + process_signal(sig); return 0; } diff --git a/src/or/main.c b/src/or/main.c index 5e4d88cf96..169956849c 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1578,12 +1578,20 @@ do_main_loop(void) /** Libevent callback: invoked when we get a signal. */ -void +static void signal_callback(int fd, short events, void *arg) { uintptr_t sig = (uintptr_t)arg; (void)fd; (void)events; + + process_signal(sig); +} + +/** Do the work of acting on a signal received in sig */ +void +process_signal(uintptr_t sig) +{ switch (sig) { case SIGTERM: diff --git a/src/or/main.h b/src/or/main.h index 626bf1c43b..0551f7aaf9 100644 --- a/src/or/main.h +++ b/src/or/main.h @@ -47,7 +47,7 @@ void ip_address_changed(int at_interface); void dns_servers_relaunch_checks(void); void handle_signals(int is_parent); -void signal_callback(int fd, short events, void *arg); +void process_signal(uintptr_t sig); int try_locking(or_options_t *options, int err_if_locked); int have_lockfile(void);