[or-cvs] [tor/master] Clarify use of magic number 0.98 with #define.
arma at seul.org
arma at seul.org
Thu Sep 17 01:46:27 UTC 2009
Author: Mike Perry <mikeperry-git at fscked.org>
Date: Wed, 16 Sep 2009 18:41:22 -0700
Subject: Clarify use of magic number 0.98 with #define.
Commit: 43c18746bd4be9db4ad68312e9e62031f056bc10
---
src/or/circuitbuild.c | 4 +---
src/or/or.h | 5 +++++
src/or/test.c | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index c20db4b..177852f 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -529,10 +529,8 @@ void
circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt,
double quantile_cutoff)
{
- /* We want to stay a bit short of 1.0, because longtail is
- * loooooooooooooooooooooooooooooooooooooooooooooooooooong */
build_time_t gentime = circuit_build_times_generate_sample(cbt,
- quantile_cutoff, 0.98);
+ quantile_cutoff, MAX_SYNTHETIC_QUANTILE);
if (gentime < (build_time_t)cbt->timeout*1000) {
log_warn(LD_CIRC,
diff --git a/src/or/or.h b/src/or/or.h
index 98fa841..bdb4d97 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2867,6 +2867,11 @@ void entry_guards_free_all(void);
* RECENT_CIRCUITS before calculating a new timeout */
#define MAX_RECENT_TIMEOUT_RATE 0.7999999
+/** Maximum quantile to use to generate synthetic timeouts.
+ * We want to stay a bit short of 1.0, because longtail is
+ * loooooooooooooooooooooooooooooooooooooooooooooooooooong. */
+#define MAX_SYNTHETIC_QUANTILE 0.98
+
/** Minimum circuits before estimating a timeout */
#define MIN_CIRCUITS_TO_OBSERVE 500
diff --git a/src/or/test.c b/src/or/test.c
index df7bead..cf00c08 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -3444,7 +3444,8 @@ test_circuit_timeout(void)
int n = 0;
for (i=0; i < MIN_CIRCUITS_TO_OBSERVE; i++) {
if (circuit_build_times_add_time(&estimate,
- circuit_build_times_generate_sample(&initial, 0, .98)) == 0) {
+ circuit_build_times_generate_sample(&initial, 0,
+ MAX_SYNTHETIC_QUANTILE)) == 0) {
n++;
}
}
--
1.5.6.5
More information about the tor-commits
mailing list