diff options
author | vagrant <vagrant@precise32.(none)> | 2013-08-21 11:44:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-08-22 10:15:56 -0400 |
commit | 4834641dce809fbb6fd4a586a823446970d19c1d (patch) | |
tree | 21808e3e34994b1e4255f3b7a106820a65ec2469 /src/or/circuitbuild.c | |
parent | 7121e7bd15659052ccf42e554ae959a75cfacb45 (diff) | |
download | tor-4834641dce809fbb6fd4a586a823446970d19c1d.tar.gz tor-4834641dce809fbb6fd4a586a823446970d19c1d.zip |
Make circ_times static and add accessor functions.
Change the global circ_times to a static variable and use
accessor functions throughout the code, instead of
accessing it directly.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 21fc2aeda3..c144f274ad 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -772,20 +772,23 @@ circuit_send_next_onion_skin(origin_circuit_t *circ) * it off at, we probably had a suspend event along this codepath, * and we should discard the value. */ - if (timediff < 0 || timediff > 2*circ_times.close_ms+1000) { + if (timediff < 0 || timediff > 2*get_circuit_build_close_time()+1000) { log_notice(LD_CIRC, "Strange value for circuit build time: %ldmsec. " "Assuming clock jump. Purpose %d (%s)", timediff, circ->base_.purpose, circuit_purpose_to_string(circ->base_.purpose)); } else if (!circuit_build_times_disabled()) { /* Only count circuit times if the network is live */ - if (circuit_build_times_network_check_live(&circ_times)) { - circuit_build_times_add_time(&circ_times, (build_time_t)timediff); - circuit_build_times_set_timeout(&circ_times); + if (circuit_build_times_network_check_live( + get_circuit_build_times())) { + circuit_build_times_add_time(get_circuit_build_times(), + (build_time_t)timediff); + circuit_build_times_set_timeout(get_circuit_build_times()); } if (circ->base_.purpose != CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT) { - circuit_build_times_network_circ_success(&circ_times); + circuit_build_times_network_circ_success( + get_circuit_build_times()); } } } @@ -2273,7 +2276,7 @@ pathbias_measure_use_rate(entry_guard_t *guard) tor_lround(guard->unusable_circuits), tor_lround(guard->collapsed_circuits), tor_lround(guard->timeouts), - tor_lround(circ_times.close_ms/1000)); + tor_lround(get_circuit_build_close_time()/1000)); guard->path_bias_disabled = 1; guard->bad_since = approx_time(); entry_guards_changed(); @@ -2299,7 +2302,7 @@ pathbias_measure_use_rate(entry_guard_t *guard) tor_lround(guard->unusable_circuits), tor_lround(guard->collapsed_circuits), tor_lround(guard->timeouts), - tor_lround(circ_times.close_ms/1000)); + tor_lround(get_circuit_build_close_time()/1000)); } } else if (pathbias_get_use_success_count(guard)/guard->use_attempts < pathbias_get_notice_use_rate(options)) { @@ -2323,7 +2326,7 @@ pathbias_measure_use_rate(entry_guard_t *guard) tor_lround(guard->unusable_circuits), tor_lround(guard->collapsed_circuits), tor_lround(guard->timeouts), - tor_lround(circ_times.close_ms/1000)); + tor_lround(get_circuit_build_close_time()/1000)); } } } @@ -2379,7 +2382,7 @@ pathbias_measure_close_rate(entry_guard_t *guard) tor_lround(guard->unusable_circuits), tor_lround(guard->collapsed_circuits), tor_lround(guard->timeouts), - tor_lround(circ_times.close_ms/1000)); + tor_lround(get_circuit_build_close_time()/1000)); guard->path_bias_disabled = 1; guard->bad_since = approx_time(); entry_guards_changed(); @@ -2405,7 +2408,7 @@ pathbias_measure_close_rate(entry_guard_t *guard) tor_lround(guard->unusable_circuits), tor_lround(guard->collapsed_circuits), tor_lround(guard->timeouts), - tor_lround(circ_times.close_ms/1000)); + tor_lround(get_circuit_build_close_time()/1000)); } } else if (pathbias_get_close_success_count(guard)/guard->circ_attempts < pathbias_get_warn_rate(options)) { @@ -2430,7 +2433,7 @@ pathbias_measure_close_rate(entry_guard_t *guard) tor_lround(guard->unusable_circuits), tor_lround(guard->collapsed_circuits), tor_lround(guard->timeouts), - tor_lround(circ_times.close_ms/1000)); + tor_lround(get_circuit_build_close_time()/1000)); } } else if (pathbias_get_close_success_count(guard)/guard->circ_attempts < pathbias_get_notice_rate(options)) { @@ -2453,7 +2456,7 @@ pathbias_measure_close_rate(entry_guard_t *guard) tor_lround(guard->unusable_circuits), tor_lround(guard->collapsed_circuits), tor_lround(guard->timeouts), - tor_lround(circ_times.close_ms/1000)); + tor_lround(get_circuit_build_close_time()/1000)); } } } |