diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-02-14 10:03:14 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-02-14 10:03:14 -0500 |
commit | f6a230ec9555688d61db37eb22c8823619332d83 (patch) | |
tree | b2e84f20e8eafa33956495fb52a0c3a40b23c3d9 /src/or/circuitlist.c | |
parent | 9e566f3a72884cd8e1c5e4e4b48ad120bfe532fc (diff) | |
parent | b65c67f0e40738b330a0f21b8bc80883466e5743 (diff) | |
download | tor-f6a230ec9555688d61db37eb22c8823619332d83.tar.gz tor-f6a230ec9555688d61db37eb22c8823619332d83.zip |
Merge remote-tracking branch 'mikeperry/bug24769'
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index db145efc53..29ad9a8ee5 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -897,8 +897,10 @@ init_circuit_base(circuit_t *circ) /** If we haven't yet decided on a good timeout value for circuit * building, we close idle circuits aggressively so we can get more - * data points. */ -#define IDLE_TIMEOUT_WHILE_LEARNING (1*60) + * data points. These are the default, min, and max consensus values */ +#define DFLT_IDLE_TIMEOUT_WHILE_LEARNING (3*60) +#define MIN_IDLE_TIMEOUT_WHILE_LEARNING (10) +#define MAX_IDLE_TIMEOUT_WHILE_LEARNING (1000*60) /** Allocate space for a new circuit, initializing with <b>p_circ_id</b> * and <b>p_conn</b>. Add it to the global circuit list. @@ -931,7 +933,11 @@ origin_circuit_new(void) circuit_build_times_needs_circuits(get_circuit_build_times())) { /* Circuits should be shorter lived if we need more of them * for learning a good build timeout */ - circ->circuit_idle_timeout = IDLE_TIMEOUT_WHILE_LEARNING; + circ->circuit_idle_timeout = + networkstatus_get_param(NULL, "cbtlearntimeout", + DFLT_IDLE_TIMEOUT_WHILE_LEARNING, + MIN_IDLE_TIMEOUT_WHILE_LEARNING, + MAX_IDLE_TIMEOUT_WHILE_LEARNING); } else { // This should always be larger than the current port prediction time // remaining, or else we'll end up with the case where a circuit times out @@ -951,7 +957,11 @@ origin_circuit_new(void) "%d seconds of predictive building remaining.", circ->circuit_idle_timeout, prediction_time_remaining); - circ->circuit_idle_timeout = IDLE_TIMEOUT_WHILE_LEARNING; + circ->circuit_idle_timeout = + networkstatus_get_param(NULL, "cbtlearntimeout", + DFLT_IDLE_TIMEOUT_WHILE_LEARNING, + MIN_IDLE_TIMEOUT_WHILE_LEARNING, + MAX_IDLE_TIMEOUT_WHILE_LEARNING); } log_info(LD_CIRC, |