diff options
author | Andrea Shepard <andrea@persephoneslair.org> | 2012-10-10 18:53:38 -0700 |
---|---|---|
committer | Andrea Shepard <andrea@persephoneslair.org> | 2012-10-10 18:53:38 -0700 |
commit | 8b36d4cc2ab95acd4c2c7203afb29a051a38c5c9 (patch) | |
tree | 92eabec1394092735e8b6e47f664f0094b76e6be /src/or/networkstatus.c | |
parent | ec97319464aab204740acb013b504abb0e13d989 (diff) | |
parent | bd28322d3815a03ca04beb6d00052d613dbe226f (diff) | |
download | tor-8b36d4cc2ab95acd4c2c7203afb29a051a38c5c9.tar.gz tor-8b36d4cc2ab95acd4c2c7203afb29a051a38c5c9.zip |
Merge branch 'bug6816_squashed_nowarn' of git://git.torproject.org/nickm/tor
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 0cc6a21085..91720b5835 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -11,7 +11,10 @@ */ #include "or.h" +#include "channel.h" #include "circuitbuild.h" +#include "circuitmux.h" +#include "circuitmux_ewma.h" #include "config.h" #include "connection.h" #include "connection_or.h" @@ -1634,6 +1637,7 @@ networkstatus_set_current_consensus(const char *consensus, consensus_waiting_for_certs_t *waiting = NULL; time_t current_valid_after = 0; int free_consensus = 1; /* Free 'c' at the end of the function */ + int old_ewma_enabled; if (flav < 0) { /* XXXX we don't handle unrecognized flavors yet. */ @@ -1827,7 +1831,18 @@ networkstatus_set_current_consensus(const char *consensus, dirvote_recalculate_timing(options, now); routerstatus_list_update_named_server_map(); - cell_ewma_set_scale_factor(options, current_consensus); + + /* Update ewma and adjust policy if needed; first cache the old value */ + old_ewma_enabled = cell_ewma_enabled(); + /* Change the cell EWMA settings */ + cell_ewma_set_scale_factor(options, networkstatus_get_latest_consensus()); + /* If we just enabled ewma, set the cmux policy on all active channels */ + if (cell_ewma_enabled() && !old_ewma_enabled) { + channel_set_cmux_policy_everywhere(&ewma_policy); + } else if (!cell_ewma_enabled() && old_ewma_enabled) { + /* Turn it off everywhere */ + channel_set_cmux_policy_everywhere(NULL); + } /* XXXX024 this call might be unnecessary here: can changing the * current consensus really alter our view of any OR's rate limits? */ |