diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2010-05-06 14:53:05 -0700 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2010-05-10 13:00:34 -0700 |
commit | eecdd94dec6cdb3515b0500a1d15170a199bee41 (patch) | |
tree | d3b4144362b6ffd2f8b0bb577aa4b0a0b14e0aed /src/or/circuitbuild.c | |
parent | e84025bc2baf9248b8e888e2e5c7eefbb6354d14 (diff) | |
download | tor-eecdd94dec6cdb3515b0500a1d15170a199bee41.tar.gz tor-eecdd94dec6cdb3515b0500a1d15170a199bee41.zip |
Add consensus parameter for max synthetic quantile.
In case we decide that the timeout rate is now too high due to our
change of the max synthetic quantile value, this consensus parameter
will allow us to restore it to the previous value.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index b54952450a..d7245c5caf 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -105,6 +105,14 @@ circuit_build_times_quantile_cutoff(void) return num/100.0; } +static double +circuit_build_times_max_synthetic_quantile(void) +{ + int32_t num = networkstatus_get_param(NULL, "cbtmaxsynthquantile", + CBT_DEFAULT_MAX_SYNTHETIC_QUANTILE); + return num/100.0; +} + static int32_t circuit_build_times_test_frequency(void) { @@ -733,7 +741,7 @@ circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt, double quantile_cutoff) { build_time_t gentime = circuit_build_times_generate_sample(cbt, - quantile_cutoff, CBT_MAX_SYNTHETIC_QUANTILE); + quantile_cutoff, circuit_build_times_max_synthetic_quantile()); if (gentime < (build_time_t)tor_lround(cbt->timeout_ms)) { log_warn(LD_CIRC, @@ -788,7 +796,7 @@ circuit_build_times_count_pretimeouts(circuit_build_times_t *cbt) ((double)cbt->pre_timeouts)/ (cbt->pre_timeouts+cbt->total_build_times); /* Make sure it doesn't exceed the synthetic max */ - timeout_quantile *= CBT_MAX_SYNTHETIC_QUANTILE; + timeout_quantile *= circuit_build_times_max_synthetic_quantile(); cbt->Xm = circuit_build_times_get_xm(cbt); tor_assert(cbt->Xm > 0); /* Use current timeout to get an estimate on alpha */ @@ -1060,7 +1068,7 @@ circuit_build_times_filter_timeouts(circuit_build_times_t *cbt) timeout_rate = circuit_build_times_timeout_rate(cbt); max_timeout = tor_lround(circuit_build_times_calculate_timeout(cbt, - CBT_MAX_SYNTHETIC_QUANTILE)); + circuit_build_times_max_synthetic_quantile())); for (i = 0; i < CBT_NCIRCUITS_TO_OBSERVE; i++) { if (cbt->circuit_build_times[i] > max_timeout) { @@ -1069,7 +1077,7 @@ circuit_build_times_filter_timeouts(circuit_build_times_t *cbt) cbt->circuit_build_times[i] = MIN(circuit_build_times_generate_sample(cbt, circuit_build_times_quantile_cutoff(), - CBT_MAX_SYNTHETIC_QUANTILE), + circuit_build_times_max_synthetic_quantile()), CBT_BUILD_TIME_MAX); log_debug(LD_CIRC, "Replaced timeout %d with %d", replaced, |