diff options
author | Roger Dingledine <arma@torproject.org> | 2009-09-20 19:50:44 -0400 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2009-09-20 19:50:44 -0400 |
commit | cf2afcd7072d20755ad030ed8240c21ec649dcd7 (patch) | |
tree | 58b8125dd4daaf3ca73eadae47e0e00eeda5ed2d /src/or/circuituse.c | |
parent | f39bedf250ce878436acda2b7217fa0b5621ffaa (diff) | |
download | tor-cf2afcd7072d20755ad030ed8240c21ec649dcd7.tar.gz tor-cf2afcd7072d20755ad030ed8240c21ec649dcd7.zip |
Fix typos and comments, plus two bugs
A) We were considering a circuit had timed out in the special cases
where we close rendezvous circuits because the final rendezvous
circuit couldn't be built in time.
B) We were looking at the wrong timestamp_created when considering
a timeout.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 95159c3b1a..1022ae16c5 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -265,7 +265,7 @@ circuit_conforms_to_options(const origin_circuit_t *circ, void circuit_expire_building(time_t now) { - circuit_t *victim, *circ = global_circuitlist; + circuit_t *victim, *next_circ = global_circuitlist; /* circ_times.timeout is BUILD_TIMEOUT_INITIAL_VALUE if we haven't * decided on a customized one yet */ time_t general_cutoff = now - lround(circ_times.timeout_ms/1000); @@ -273,10 +273,10 @@ circuit_expire_building(time_t now) time_t introcirc_cutoff = begindir_cutoff; cpath_build_state_t *build_state; - while (circ) { + while (next_circ) { time_t cutoff; - victim = circ; - circ = circ->next; + victim = next_circ; + next_circ = next_circ->next; if (!CIRCUIT_IS_ORIGIN(victim) || /* didn't originate here */ victim->marked_for_close) /* don't mess with marked circs */ continue; @@ -347,6 +347,12 @@ circuit_expire_building(time_t now) continue; break; } + } else { /* circuit not open, consider recording failure as timeout */ + int first_hop_succeeded = TO_ORIGIN_CIRCUIT(victim)->cpath && + TO_ORIGIN_CIRCUIT(victim)->cpath->state == CPATH_STATE_OPEN; + if (circuit_build_times_add_timeout(&circ_times, first_hop_succeeded, + victim->timestamp_created)) + circuit_build_times_set_timeout(&circ_times); } if (victim->n_conn) @@ -362,13 +368,6 @@ circuit_expire_building(time_t now) circuit_log_path(LOG_INFO,LD_CIRC,TO_ORIGIN_CIRCUIT(victim)); circuit_mark_for_close(victim, END_CIRC_REASON_TIMEOUT); - - if (circuit_build_times_add_timeout(&circ_times, - TO_ORIGIN_CIRCUIT(circ)->cpath - && TO_ORIGIN_CIRCUIT(circ)->cpath->state == CPATH_STATE_OPEN, - circ->timestamp_created)) { - circuit_build_times_set_timeout(&circ_times); - } } } |