[tor-commits] [tor/master] Change lost_owning_controller() to call activate_signal().

nickm at torproject.org nickm at torproject.org
Mon Aug 17 20:25:06 UTC 2015


commit c7c73f117827b40c4086203f2bead9b45c0539e8
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Aug 13 09:13:21 2015 -0400

    Change lost_owning_controller() to call activate_signal().
    
    Closes ticket 16788.
---
 changes/decouple_lost_owner |    4 ++++
 src/or/control.c            |   11 +----------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/changes/decouple_lost_owner b/changes/decouple_lost_owner
new file mode 100644
index 0000000..88adb18
--- /dev/null
+++ b/changes/decouple_lost_owner
@@ -0,0 +1,4 @@
+  o Code simplification and refactoring:
+    - Treat the loss of an owning controller as equivalent to a SIGTERM
+      signal. This removes a tiny amount of duplicated code, and simplifies
+      our callgraph. Closes ticekt 16788.
diff --git a/src/or/control.c b/src/or/control.c
index a0004c3..a507303 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -3932,10 +3932,6 @@ connection_control_reached_eof(control_connection_t *conn)
   return 0;
 }
 
-static void lost_owning_controller(const char *owner_type,
-                                   const char *loss_manner)
-  ATTR_NORETURN;
-
 /** Shut down this Tor instance in the same way that SIGINT would, but
  * with a log message appropriate for the loss of an owning controller. */
 static void
@@ -3944,10 +3940,7 @@ lost_owning_controller(const char *owner_type, const char *loss_manner)
   log_notice(LD_CONTROL, "Owning controller %s has %s -- exiting now.",
              owner_type, loss_manner);
 
-  /* XXXX Perhaps this chunk of code should be a separate function,
-   * called here and by process_signal(SIGINT). */
-  tor_cleanup();
-  exit(0);
+  activate_signal(SIGTERM);
 }
 
 /** Called when <b>conn</b> is being freed. */
@@ -5552,8 +5545,6 @@ static char *owning_controller_process_spec = NULL;
  * if this Tor instance is not currently owned by a process. */
 static tor_process_monitor_t *owning_controller_process_monitor = NULL;
 
-static void owning_controller_procmon_cb(void *unused) ATTR_NORETURN;
-
 /** Process-termination monitor callback for Tor's owning controller
  * process. */
 static void





More information about the tor-commits mailing list