mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Expose a new process_signal(uintptr_t), not signal_callback()
This is a tweak to the bug2917 fix. Basically, if we want to simulate a signal arriving in the controller, we shouldn't have to pretend that we're Libevent, or depend on how Tor sets up its Libevent callbacks.
This commit is contained in:
parent
a7a906603e
commit
f810a1afe9
@ -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;
|
||||
}
|
||||
|
@ -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 <b>sig</b> */
|
||||
void
|
||||
process_signal(uintptr_t sig)
|
||||
{
|
||||
switch (sig)
|
||||
{
|
||||
case SIGTERM:
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user