Bug 1357: Store the suspended timeout value to resume.

This prevents a spurious warning where we have a timeout just after
deciding our network came back online.
This commit is contained in:
Mike Perry 2010-05-08 10:41:00 -07:00
parent 728e946efd
commit 0a6191cf70
2 changed files with 7 additions and 5 deletions

View File

@ -922,17 +922,18 @@ circuit_build_times_network_check_live(circuit_build_times_t *cbt)
"Temporarily raising timeout to %lds.", "Temporarily raising timeout to %lds.",
(long int)(now - cbt->liveness.network_last_live), (long int)(now - cbt->liveness.network_last_live),
tor_lround(circuit_build_times_get_initial_timeout()/1000)); tor_lround(circuit_build_times_get_initial_timeout()/1000));
cbt->liveness.suspended_timeout = cbt->timeout_ms;
cbt->timeout_ms = circuit_build_times_get_initial_timeout(); cbt->timeout_ms = circuit_build_times_get_initial_timeout();
cbt->liveness.net_suspended = 1;
control_event_buildtimeout_set(cbt, BUILDTIMEOUT_SET_EVENT_SUSPENDED); control_event_buildtimeout_set(cbt, BUILDTIMEOUT_SET_EVENT_SUSPENDED);
} }
return 0; return 0;
} else if (cbt->liveness.net_suspended) { } else if (cbt->liveness.suspended_timeout) {
log_notice(LD_CIRC, log_notice(LD_CIRC,
"Network activity has resumed. " "Network activity has resumed. "
"Resuming circuit timeout calculations."); "Resuming circuit timeout calculations.");
cbt->liveness.net_suspended = 0; cbt->timeout_ms = cbt->liveness.suspended_timeout;
cbt->liveness.suspended_timeout = 0;
control_event_buildtimeout_set(cbt, BUILDTIMEOUT_SET_EVENT_RESUME); control_event_buildtimeout_set(cbt, BUILDTIMEOUT_SET_EVENT_RESUME);
} }

View File

@ -3108,8 +3108,9 @@ typedef struct {
int num_recent_circs; int num_recent_circs;
/** Index into circular array. */ /** Index into circular array. */
int after_firsthop_idx; int after_firsthop_idx;
/** The network is not live. Timeout gathering is suspended */ /** Timeout gathering is suspended if non-zero. The old timeout value
int net_suspended; * is stored here in that case. */
build_time_t suspended_timeout;
} network_liveness_t; } network_liveness_t;
/** Structure for circuit build times history */ /** Structure for circuit build times history */