[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/master] Merge branch 'bug2321' into maint-0.2.2
commit 1478aa99b7f113ccb800dc9a94e3501968aa59c6
Merge: 9e7691b 9a4b2ec
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Jan 26 11:06:55 2011 -0500
Merge branch 'bug2321' into maint-0.2.2
src/or/circuitbuild.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --combined src/or/circuitbuild.c
index b49b7e0,5c9c1ac..4f8f5fb
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@@ -99,15 -99,6 +99,15 @@@ static int onion_append_hop(crypt_path_
static void entry_guards_changed(void);
+/**
+ * This function decides if CBT learning should be disabled. It returns
+ * true if one or more of the following four conditions are met:
+ *
+ * 1. If the cbtdisabled consensus parameter is set.
+ * 2. If the torrc option LearnCircuitBuildTimeout is false.
+ * 3. If we are a directory authority
+ * 4. If we fail to write circuit build time history to our state file.
+ */
static int
circuit_build_times_disabled(void)
{
@@@ -134,13 -125,6 +134,13 @@@
}
}
+/**
+ * Retrieve and bounds-check the cbtmaxtimeouts consensus paramter.
+ *
+ * Effect: When this many timeouts happen in the last 'cbtrecentcount'
+ * circuit attempts, the client should discard all of its history and
+ * begin learning a fresh timeout value.
+ */
static int32_t
circuit_build_times_max_timeouts(void)
{
@@@ -150,15 -134,6 +150,15 @@@
CBT_MAX_MAX_RECENT_TIMEOUT_COUNT);
}
+/**
+ * Retrieve and bounds-check the cbtnummodes consensus paramter.
+ *
+ * Effect: This value governs how many modes to use in the weighted
+ * average calculation of Pareto parameter Xm. A value of 3 introduces
+ * some bias (2-5% of CDF) under ideal conditions, but allows for better
+ * performance in the event that a client chooses guard nodes of radically
+ * different performance characteristics.
+ */
static int32_t
circuit_build_times_default_num_xm_modes(void)
{
@@@ -169,12 -144,6 +169,12 @@@
return num;
}
+/**
+ * Retrieve and bounds-check the cbtmincircs consensus paramter.
+ *
+ * Effect: This is the minimum number of circuits to build before
+ * computing a timeout.
+ */
static int32_t
circuit_build_times_min_circs_to_observe(void)
{
@@@ -193,12 -162,6 +193,12 @@@ circuit_build_times_enough_to_compute(c
return cbt->total_build_times >= circuit_build_times_min_circs_to_observe();
}
+/**
+ * Retrieve and bounds-check the cbtquantile consensus paramter.
+ *
+ * Effect: This is the position on the quantile curve to use to set the
+ * timeout value. It is a percent (10-99).
+ */
double
circuit_build_times_quantile_cutoff(void)
{
@@@ -218,13 -181,6 +218,13 @@@ circuit_build_times_get_bw_scale(networ
BW_MAX_WEIGHT_SCALE);
}
+/**
+ * Retrieve and bounds-check the cbtclosequantile consensus paramter.
+ *
+ * Effect: This is the position on the quantile curve to use to set the
+ * timeout value to use to actually close circuits. It is a percent
+ * (0-99).
+ */
static double
circuit_build_times_close_quantile(void)
{
@@@ -243,13 -199,6 +243,13 @@@
return param / 100.0;
}
+/**
+ * Retrieve and bounds-check the cbttestfreq consensus paramter.
+ *
+ * Effect: Describes how often in seconds to build a test circuit to
+ * gather timeout values. Only applies if less than 'cbtmincircs'
+ * have been recorded.
+ */
static int32_t
circuit_build_times_test_frequency(void)
{
@@@ -260,13 -209,6 +260,13 @@@
return num;
}
+/**
+ * Retrieve and bounds-check the cbtmintimeout consensus paramter.
+ *
+ * Effect: This is the minimum allowed timeout value in milliseconds.
+ * The minimum is to prevent rounding to 0 (we only check once
+ * per second).
+ */
static int32_t
circuit_build_times_min_timeout(void)
{
@@@ -277,12 -219,6 +277,12 @@@
return num;
}
+/**
+ * Retrieve and bounds-check the cbtinitialtimeout consensus paramter.
+ *
+ * Effect: This is the timeout value to use before computing a timeout,
+ * in milliseconds.
+ */
int32_t
circuit_build_times_initial_timeout(void)
{
@@@ -299,13 -235,6 +299,13 @@@
return param;
}
+/**
+ * Retrieve and bounds-check the cbtrecentcount consensus paramter.
+ *
+ * Effect: This is the number of circuit build times to keep track of
+ * for deciding if we hit cbtmaxtimeouts and need to reset our state
+ * and learn a new timeout.
+ */
static int32_t
circuit_build_times_recent_circuit_count(networkstatus_t *ns)
{
@@@ -329,9 -258,8 +329,9 @@@ circuit_build_times_new_consensus_param
if (num > 0 && num != cbt->liveness.num_recent_circs) {
int8_t *recent_circs;
- log_notice(LD_CIRC, "Changing recent timeout size from %d to %d",
- cbt->liveness.num_recent_circs, num);
+ log_notice(LD_CIRC, "The Tor Directory Consensus has changed how many "
+ "circuits we must track to detect network failures from %d "
+ "to %d.", cbt->liveness.num_recent_circs, num);
tor_assert(cbt->liveness.timeouts_after_firsthop);
@@@ -660,14 -588,12 +660,14 @@@ circuit_build_times_update_state(circui
static void
circuit_build_times_shuffle_and_store_array(circuit_build_times_t *cbt,
build_time_t *raw_times,
- int num_times)
+ uint32_t num_times)
{
- int n = num_times;
+ uint32_t n = num_times;
if (num_times > CBT_NCIRCUITS_TO_OBSERVE) {
- log_notice(LD_CIRC, "Decreasing circuit_build_times size from %d to %d",
- num_times, CBT_NCIRCUITS_TO_OBSERVE);
+ log_notice(LD_CIRC, "The number of circuit times that this Tor version "
+ "uses to calculate build times is less than the number stored "
+ "in your state file. Decreasing the circuit time history from "
+ "%d to %d.", num_times, CBT_NCIRCUITS_TO_OBSERVE);
}
/* This code can only be run on a compact array */
@@@ -1148,7 -1074,7 +1148,7 @@@ circuit_build_times_network_close(circu
if (cbt->liveness.nonlive_timeouts == 1) {
log_notice(LD_CIRC,
"Tor has not observed any network activity for the past %d "
- "seconds. Disabling circuit build timeout code.",
+ "seconds. Disabling circuit build timeout recording.",
(int)(now - cbt->liveness.network_last_live));
} else {
log_info(LD_CIRC,
@@@ -1232,7 -1158,7 +1232,7 @@@ circuit_build_times_network_check_chang
control_event_buildtimeout_set(cbt, BUILDTIMEOUT_SET_EVENT_RESET);
log_notice(LD_CIRC,
- "Network connection speed appears to have changed. Resetting "
+ "Your network connection speed appears to have changed. Resetting "
"timeout to %lds after %d timeouts and %d buildtimes.",
tor_lround(cbt->timeout_ms/1000), timeout_count,
total_build_times);
@@@ -1370,7 -1296,7 +1370,7 @@@ circuit_build_times_set_timeout_worker(
}
if (max_time < INT32_MAX/2 && cbt->close_ms > 2*max_time) {
- log_notice(LD_CIRC,
+ log_info(LD_CIRC,
"Circuit build measurement period of %dms is more than twice "
"the maximum build time we have ever observed. Capping it to "
"%dms.", (int)cbt->close_ms, 2*max_time);