diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-03-26 01:39:11 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-03-30 14:41:53 -0400 |
commit | 65eb0e41ac05fd65bf8bef87426886fec45f7ca4 (patch) | |
tree | d6bd33c92188eefa774e6550a89ece87cf47eef1 | |
parent | aa950e6c48471f00ff9497fa4e9fad1c71e75868 (diff) | |
download | tor-65eb0e41ac05fd65bf8bef87426886fec45f7ca4.tar.gz tor-65eb0e41ac05fd65bf8bef87426886fec45f7ca4.zip |
Use cbt to tell when to launch parallel intro circuit
Implement feature from trac #2799
-rw-r--r-- | changes/cbt_parallel_intro | 4 | ||||
-rw-r--r-- | src/or/circuituse.c | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/changes/cbt_parallel_intro b/changes/cbt_parallel_intro new file mode 100644 index 0000000000..44e377fb3f --- /dev/null +++ b/changes/cbt_parallel_intro @@ -0,0 +1,4 @@ + o Minor features + - Use computed circuit-build timeouts to decide when to launch + parallel introdution circuits. (Previously, we would retry + after 15 seconds.) diff --git a/src/or/circuituse.c b/src/or/circuituse.c index ac4bba51f8..447ec8412d 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -204,7 +204,7 @@ circuit_get_best(edge_connection_t *conn, int must_be_open, uint8_t purpose, int need_uptime, int need_internal) { circuit_t *circ, *best=NULL; - time_t now = time(NULL); + struct timeval now; int intro_going_on_but_too_old = 0; tor_assert(conn); @@ -213,17 +213,16 @@ circuit_get_best(edge_connection_t *conn, int must_be_open, uint8_t purpose, purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT || purpose == CIRCUIT_PURPOSE_C_REND_JOINED); + tor_gettimeofday(&now); + for (circ=global_circuitlist;circ;circ = circ->next) { if (!circuit_is_acceptable(circ,conn,must_be_open,purpose, - need_uptime,need_internal,now)) + need_uptime,need_internal,now.tv_sec)) continue; -/* XXX022 make this 15 be a function of circuit finishing times we've - * seen lately, a la Fallon Chen's GSoC work -RD */ -#define REND_PARALLEL_INTRO_DELAY 15 if (purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT && - !must_be_open && circ->state != CIRCUIT_STATE_OPEN && - circ->timestamp_created.tv_sec + REND_PARALLEL_INTRO_DELAY < now) { + !must_be_open && circ->state != CIRCUIT_STATE_OPEN && + tv_mdiff(&now, &circ->timestamp_created) > circ_times.timeout_ms) { intro_going_on_but_too_old = 1; continue; } |