Kaynağa Gözat

Change lost_owning_controller() to call activate_signal().

Closes ticket 16788.
Nick Mathewson 8 yıl önce
ebeveyn
işleme
c7c73f1178
2 değiştirilmiş dosya ile 5 ekleme ve 10 silme
  1. 4 0
      changes/decouple_lost_owner
  2. 1 10
      src/or/control.c

+ 4 - 0
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.

+ 1 - 10
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