aboutsummaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2010-08-15 04:01:42 -0400
committerRoger Dingledine <arma@torproject.org>2010-08-15 04:01:42 -0400
commit8d588e7b1a4fccffaa8318ed14d00a2ef615c53a (patch)
tree2c9580ada20875112cca1b120ade06d1f5a498fd /src/or/networkstatus.c
parent2bc1842aaac1119a840b8ed3fa815c6f71053ac7 (diff)
downloadtor-8d588e7b1a4fccffaa8318ed14d00a2ef615c53a.tar.gz
tor-8d588e7b1a4fccffaa8318ed14d00a2ef615c53a.zip
reinit per-conn token buckets on config or consensus change
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 54b77992cd..0ec69cb29b 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -14,10 +14,12 @@
#include "circuitbuild.h"
#include "config.h"
#include "connection.h"
+#include "connection_or.h"
#include "control.h"
#include "directory.h"
#include "dirserv.h"
#include "dirvote.h"
+#include "main.h"
#include "networkstatus.h"
#include "relay.h"
#include "router.h"
@@ -1506,6 +1508,7 @@ networkstatus_set_current_consensus(const char *consensus,
networkstatus_t *c=NULL;
int r, result = -1;
time_t now = time(NULL);
+ or_options_t *options = get_options();
char *unverified_fname = NULL, *consensus_fname = NULL;
int flav = networkstatus_parse_flavor_name(flavor);
const unsigned from_cache = flags & NSSET_FROM_CACHE;
@@ -1543,7 +1546,7 @@ networkstatus_set_current_consensus(const char *consensus,
}
if (flav != USABLE_CONSENSUS_FLAVOR &&
- !directory_caches_dir_info(get_options())) {
+ !directory_caches_dir_info(options)) {
/* This consensus is totally boring to us: we won't use it, and we won't
* serve it. Drop it. */
goto done;
@@ -1678,7 +1681,7 @@ networkstatus_set_current_consensus(const char *consensus,
download_status_failed(&consensus_dl_status[flav], 0);
}
- if (directory_caches_dir_info(get_options())) {
+ if (directory_caches_dir_info(options)) {
dirserv_set_cached_consensus_networkstatus(consensus,
flavor,
&c->digests,
@@ -1691,9 +1694,13 @@ networkstatus_set_current_consensus(const char *consensus,
/* XXXXNM Microdescs: needs a non-ns variant. */
update_consensus_networkstatus_fetch_time(now);
- dirvote_recalculate_timing(get_options(), now);
+ dirvote_recalculate_timing(options, now);
routerstatus_list_update_named_server_map();
- cell_ewma_set_scale_factor(get_options(), current_consensus);
+ cell_ewma_set_scale_factor(options, current_consensus);
+
+ /* XXX022 where is the right place to put this call? */
+ connection_or_update_token_buckets(get_connection_array(), options);
+
circuit_build_times_new_consensus_params(&circ_times, current_consensus);
}