[tor-commits] [tor/master] Call cpu_init if we change to being a relay

nickm at torproject.org nickm at torproject.org
Sun Feb 15 14:25:36 UTC 2015


commit 3bcdb26267502e0d1de5d01854c8a2cf29a5e5f4
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Sun Feb 15 11:49:19 2015 +0100

    Call cpu_init if we change to being a relay
    
    The issue is that we use the cpuworker system with relays only, so if we
    start up as a client and transition to being a relay later, we'll be
    sad.
    
    This fixes bug 14901; not in any released version of Tor.
---
 src/or/config.c    |    1 +
 src/or/cpuworker.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/or/config.c b/src/or/config.c
index ad4fd45..8d15d0d 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1721,6 +1721,7 @@ options_act(const or_options_t *old_options)
                "Worker-related options changed. Rotating workers.");
 
       if (server_mode(options) && !server_mode(old_options)) {
+        cpu_init();
         ip_address_changed(0);
         if (have_completed_a_circuit() || !any_predicted_circuits(time(NULL)))
           inform_testing_reachability();
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index c5e78ed..5787c75 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -71,7 +71,8 @@ replyqueue_process_cb(evutil_socket_t sock, short events, void *arg)
   replyqueue_process(rq);
 }
 
-/** Initialize the cpuworker subsystem.
+/** Initialize the cpuworker subsystem. It is OK to call this more than once
+ * during Tor's lifetime.
  */
 void
 cpu_init(void)



More information about the tor-commits mailing list