[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Expose a new process_signal(uintptr_t), not signal_callback()



commit f810a1afe990788cd8f944a515a493902df84ed1
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Apr 26 15:20:08 2011 -0400

    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.
---
 src/or/control.c |    3 ++-
 src/or/main.c    |   10 +++++++++-
 src/or/main.h    |    2 +-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/or/control.c b/src/or/control.c
index bb1c330..9f7739a 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 5e4d88c..1699568 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 <b>sig</b> */
+void
+process_signal(uintptr_t sig)
+{
   switch (sig)
     {
     case SIGTERM:
diff --git a/src/or/main.h b/src/or/main.h
index 626bf1c..0551f7a 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);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits