aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2010-09-29 08:47:35 -0700
committerMike Perry <mikeperry-git@fscked.org>2010-09-29 11:49:43 -0700
commit0744a175afa559435bd0e3cdb53891282469e0ee (patch)
treeb8683dde9bb447806145d0ab5e0a93809e891fbf /src
parent9a77743b7b2e657cb8d9fd413d53cb9e3b8e00ca (diff)
downloadtor-0744a175afa559435bd0e3cdb53891282469e0ee.tar.gz
tor-0744a175afa559435bd0e3cdb53891282469e0ee.zip
Fix state checks on liveness handling.
If we really want all this complexity for these stages here, we need to handle it better for people with large timeouts. It should probably go away, though.
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 4f4d9c70d2..81b63fe64d 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1034,17 +1034,25 @@ circuit_build_times_network_check_live(circuit_build_times_t *cbt)
return 0;
} else if (cbt->liveness.nonlive_timeouts >=
CBT_NETWORK_NONLIVE_TIMEOUT_COUNT) {
- // XXX: We won't ever conclude the network is flaky here for poor arma...
- if (cbt->timeout_ms < circuit_build_times_get_initial_timeout()) {
+ if (cbt->liveness.suspended_timeout <= 0) {
+ cbt->liveness.suspended_timeout = cbt->timeout_ms;
+ cbt->liveness.suspended_close_timeout = cbt->close_ms;
+
+ if (cbt->timeout_ms < circuit_build_times_get_initial_timeout())
+ cbt->timeout_ms = circuit_build_times_get_initial_timeout();
+ else
+ cbt->timeout_ms *= 2;
+
+ if (cbt->close_ms < circuit_build_times_get_initial_timeout())
+ cbt->close_ms = circuit_build_times_get_initial_timeout();
+ else
+ cbt->close_ms *= 2;
+
log_notice(LD_CIRC,
"Network is flaky. No activity for %ld seconds. "
"Temporarily raising timeout to %lds.",
(long int)(now - cbt->liveness.network_last_live),
- tor_lround(circuit_build_times_get_initial_timeout()/1000));
- cbt->liveness.suspended_timeout = cbt->timeout_ms;
- cbt->liveness.suspended_close_timeout = cbt->close_ms;
- cbt->close_ms = cbt->timeout_ms
- = circuit_build_times_get_initial_timeout();
+ tor_lround(cbt->timeout_ms/1000));
control_event_buildtimeout_set(cbt, BUILDTIMEOUT_SET_EVENT_SUSPENDED);
}