aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2009-09-15 06:33:33 -0400
committerRoger Dingledine <arma@torproject.org>2009-09-15 06:33:33 -0400
commitc43859c5c12361fad50580cd76f6484dfaa6b88d (patch)
tree51b9a69d25e6c9923452aee270518de554968098 /src/or/circuitlist.c
parent40bcab1faf26dd26de48b5ea6c1846c562a11f9d (diff)
downloadtor-c43859c5c12361fad50580cd76f6484dfaa6b88d.tar.gz
tor-c43859c5c12361fad50580cd76f6484dfaa6b88d.zip
Read "circwindow=x" from the consensus and use it
Tor now reads the "circwindow" parameter out of the consensus, and uses that value for its circuit package window rather than the default of 1000 cells. Begins the implementation of proposal 168.
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 065559620c..e1da117168 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -361,6 +361,18 @@ circuit_purpose_to_controller_string(uint8_t purpose)
}
}
+/** Pick a reasonable package_window to start out for our circuits.
+ * Originally this was hard-coded at 1000, but now the consensus votes
+ * on the answer. See proposal 168. */
+int32_t
+circuit_initial_package_window(void)
+{
+ networkstatus_t *consensus = networkstatus_get_latest_consensus();
+ if (consensus)
+ return networkstatus_get_param(consensus, "circwindow", CIRCWINDOW_START);
+ return CIRCWINDOW_START;
+}
+
/** Initialize the common elements in a circuit_t, and add it to the global
* list. */
static void
@@ -368,7 +380,7 @@ init_circuit_base(circuit_t *circ)
{
circ->timestamp_created = time(NULL);
- circ->package_window = CIRCWINDOW_START;
+ circ->package_window = circuit_initial_package_window();
circ->deliver_window = CIRCWINDOW_START;
circuit_add(circ);