Rename get_circuit_nbuild_* to end with _ms

This commit is contained in:
Nick Mathewson 2013-08-21 11:59:19 -04:00
parent 4834641dce
commit e1c9b43b8e
4 changed files with 23 additions and 22 deletions

View File

@ -772,7 +772,8 @@ 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*get_circuit_build_close_time()+1000) {
if (timediff < 0 ||
timediff > 2*get_circuit_build_close_time_ms()+1000) {
log_notice(LD_CIRC, "Strange value for circuit build time: %ldmsec. "
"Assuming clock jump. Purpose %d (%s)", timediff,
circ->base_.purpose,
@ -2276,7 +2277,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(get_circuit_build_close_time()/1000));
tor_lround(get_circuit_build_close_time_ms()/1000));
guard->path_bias_disabled = 1;
guard->bad_since = approx_time();
entry_guards_changed();
@ -2302,7 +2303,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(get_circuit_build_close_time()/1000));
tor_lround(get_circuit_build_close_time_ms()/1000));
}
} else if (pathbias_get_use_success_count(guard)/guard->use_attempts
< pathbias_get_notice_use_rate(options)) {
@ -2326,7 +2327,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(get_circuit_build_close_time()/1000));
tor_lround(get_circuit_build_close_time_ms()/1000));
}
}
}
@ -2382,7 +2383,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(get_circuit_build_close_time()/1000));
tor_lround(get_circuit_build_close_time_ms()/1000));
guard->path_bias_disabled = 1;
guard->bad_since = approx_time();
entry_guards_changed();
@ -2408,7 +2409,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(get_circuit_build_close_time()/1000));
tor_lround(get_circuit_build_close_time_ms()/1000));
}
} else if (pathbias_get_close_success_count(guard)/guard->circ_attempts
< pathbias_get_warn_rate(options)) {
@ -2433,7 +2434,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(get_circuit_build_close_time()/1000));
tor_lround(get_circuit_build_close_time_ms()/1000));
}
} else if (pathbias_get_close_success_count(guard)/guard->circ_attempts
< pathbias_get_notice_rate(options)) {
@ -2456,7 +2457,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(get_circuit_build_close_time()/1000));
tor_lround(get_circuit_build_close_time_ms()/1000));
}
}
}

View File

@ -43,13 +43,13 @@ get_circuit_build_times(void)
}
double
get_circuit_build_close_time(void)
get_circuit_build_close_time_ms(void)
{
return circ_times.close_ms;
}
double
get_circuit_build_timeout(void)
get_circuit_build_timeout_ms(void)
{
return circ_times.timeout_ms;
}

View File

@ -13,8 +13,8 @@
#define TOR_CIRCUITSTATS_H
circuit_build_times_t *get_circuit_build_times(void);
double get_circuit_build_close_time(void);
double get_circuit_build_timeout(void);
double get_circuit_build_close_time_ms(void);
double get_circuit_build_timeout_ms(void);
int circuit_build_times_disabled(void);
int circuit_build_times_enough_to_compute(circuit_build_times_t *cbt);

View File

@ -442,12 +442,12 @@ circuit_expire_building(void)
* RTTs = 4a + 3b + 2c
* RTTs = 9h
*/
SET_CUTOFF(general_cutoff, get_circuit_build_timeout());
SET_CUTOFF(begindir_cutoff, get_circuit_build_timeout());
SET_CUTOFF(general_cutoff, get_circuit_build_timeout_ms());
SET_CUTOFF(begindir_cutoff, get_circuit_build_timeout_ms());
/* > 3hop circs seem to have a 1.0 second delay on their cannibalized
* 4th hop. */
SET_CUTOFF(fourhop_cutoff, get_circuit_build_timeout() * (10/6.0) + 1000);
SET_CUTOFF(fourhop_cutoff, get_circuit_build_timeout_ms() * (10/6.0) + 1000);
/* CIRCUIT_PURPOSE_C_ESTABLISH_REND behaves more like a RELAY cell.
* Use the stream cutoff (more or less). */
@ -456,20 +456,20 @@ circuit_expire_building(void)
/* Be lenient with cannibalized circs. They already survived the official
* CBT, and they're usually not performance-critical. */
SET_CUTOFF(cannibalized_cutoff,
MAX(get_circuit_build_close_time()*(4/6.0),
MAX(get_circuit_build_close_time_ms()*(4/6.0),
options->CircuitStreamTimeout * 1000) + 1000);
/* Intro circs have an extra round trip (and are also 4 hops long) */
SET_CUTOFF(c_intro_cutoff, get_circuit_build_timeout() * (14/6.0) + 1000);
SET_CUTOFF(c_intro_cutoff, get_circuit_build_timeout_ms() * (14/6.0) + 1000);
/* Server intro circs have an extra round trip */
SET_CUTOFF(s_intro_cutoff, get_circuit_build_timeout() * (9/6.0) + 1000);
SET_CUTOFF(s_intro_cutoff, get_circuit_build_timeout_ms() * (9/6.0) + 1000);
SET_CUTOFF(close_cutoff, get_circuit_build_close_time());
SET_CUTOFF(extremely_old_cutoff, get_circuit_build_close_time()*2 + 1000);
SET_CUTOFF(close_cutoff, get_circuit_build_close_time_ms());
SET_CUTOFF(extremely_old_cutoff, get_circuit_build_close_time_ms()*2 + 1000);
SET_CUTOFF(hs_extremely_old_cutoff,
MAX(get_circuit_build_close_time()*2 + 1000,
MAX(get_circuit_build_close_time_ms()*2 + 1000,
options->SocksTimeout * 1000));
TOR_LIST_FOREACH(next_circ, circuit_get_global_list(), head) {
@ -552,7 +552,7 @@ circuit_expire_building(void)
continue;
} else {
static ratelim_t relax_timeout_limit = RATELIM_INIT(3600);
const double build_close_ms = get_circuit_build_close_time();
const double build_close_ms = get_circuit_build_close_time_ms();
log_fn_ratelim(&relax_timeout_limit, LOG_NOTICE, LD_CIRC,
"No circuits are opened. Relaxed timeout for circuit %d "
"(a %s %d-hop circuit in state %s with channel state %s) to "