]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Expose a new process_signal(uintptr_t), not signal_callback()
authorNick Mathewson <nickm@torproject.org>
Tue, 26 Apr 2011 19:20:08 +0000 (15:20 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 26 Apr 2011 19:20:08 +0000 (15:20 -0400)
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.

src/or/control.c
src/or/main.c
src/or/main.h

index bb1c3307af882f90d7241e5b906c0196c9d52412..9f7739a402669d6d20a823c5ac036eeae5750c38 100644 (file)
@@ -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;
 }
index 5e4d88cf96455ca95147654dbe715938b104de62..169956849cc8cd5d384c9ef0a10569d48d3f1033 100644 (file)
@@ -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:
index 626bf1c43bb312a9bcd1cf22560fadcba0c9f7f5..0551f7aaf909c6aa4b10f272a03e3348e81db1b8 100644 (file)
@@ -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);