diff options
author | Can Tang <c24tang@uwaterloo.ca> | 2009-12-10 11:12:42 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-12-12 19:06:38 -0500 |
commit | d3be00e0f454998db6387c8547d218a0db93db21 (patch) | |
tree | c2a90125dd9da2cdd283cf045be7fb3ec02d7745 /src/or/circuitlist.c | |
parent | c210db0d41f4a47496e12c0af829f8ae0a5c2cd2 (diff) | |
download | tor-d3be00e0f454998db6387c8547d218a0db93db21.tar.gz tor-d3be00e0f454998db6387c8547d218a0db93db21.zip |
Favor quiet circuits when choosing which order to relay cells in.
Each circuit is ranked in terms of how many cells from it have been
relayed recently, using a time-weighted average.
This patch has been tested this on a private Tor network on PlanetLab,
and gotten improvements of 12-35% in time it takes to fetch a small
web page while there's a simultaneous large data transfer going on
simultaneously.
[Commit msg by nickm based on mail from Ian Goldberg.]
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 2c949def00..eb8c90f460 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -385,6 +385,10 @@ init_circuit_base(circuit_t *circ) circ->package_window = circuit_initial_package_window(); circ->deliver_window = CIRCWINDOW_START; + /* Initialize the cell_ewma_t structure */ + circ->n_cell_ewma.last_cell_time = circ->highres_created; + circ->n_cell_ewma.cell_count = 0.0; + circuit_add(circ); } @@ -432,6 +436,14 @@ or_circuit_new(circid_t p_circ_id, or_connection_t *p_conn) init_circuit_base(TO_CIRCUIT(circ)); + /* Initialize the cell_ewma_t structure */ + + /* Fetch the timeval that init_circuit_base filled in. */ + circ->p_cell_ewma.last_cell_time = TO_CIRCUIT(circ)->highres_created; + + /* Initialize the cell counts to 0 */ + circ->p_cell_ewma.cell_count = 0.0; + return circ; } |