summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-08-13 09:13:21 -0400
committerNick Mathewson <nickm@torproject.org>2015-08-13 09:17:41 -0400
commitc7c73f117827b40c4086203f2bead9b45c0539e8 (patch)
treeeb18fe184f245874e29c92170421545a702f7e96
parentf4f0b4326891e2e5907ff252c704c7f19bbfaf0d (diff)
downloadtor-c7c73f117827b40c4086203f2bead9b45c0539e8.tar.gz
tor-c7c73f117827b40c4086203f2bead9b45c0539e8.zip
Change lost_owning_controller() to call activate_signal().
Closes ticket 16788.
-rw-r--r--changes/decouple_lost_owner4
-rw-r--r--src/or/control.c11
2 files changed, 5 insertions, 10 deletions
diff --git a/changes/decouple_lost_owner b/changes/decouple_lost_owner
new file mode 100644
index 0000000000..88adb18546
--- /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 a0004c3dbe..a5073037ab 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