summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-06-22 14:08:19 -0400
committerNick Mathewson <nickm@torproject.org>2009-06-22 14:08:19 -0400
commit39551b494ea0f7a1bb8ddc1de270ebf8fbf6c0eb (patch)
treee8596ccff812784473911e0ba4c810bf61f0e6f1
parent3f4f6f907539f7fa7ef4a292a70431ed6ab9628a (diff)
parentb91428cfd36d1014bbd77ea1a53cddded92a6d14 (diff)
downloadtor-39551b494ea0f7a1bb8ddc1de270ebf8fbf6c0eb.tar.gz
tor-39551b494ea0f7a1bb8ddc1de270ebf8fbf6c0eb.zip
Merge commit 'origin/maint-0.2.1'
-rw-r--r--ChangeLog7
-rw-r--r--src/or/routerlist.c22
2 files changed, 25 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ca7af59f5..086618c35b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,13 @@ Changes in version 0.2.1.17-?? - 2009-??-??
- Serve the DirPortFrontPage page even when we have been approaching
our quotas recently. Fixes bug 1013; bugfix on 0.2.1.8-alpha.
+ o Major features:
+ - Clients now use the bandwidth values in the consensus, rather than
+ the bandwidth values in each relay descriptor. This approach opens
+ the door to more accurate bandwidth estimates once the directory
+ authorities start doing active measurements. Implements more of
+ proposal 141.
+
Changes in version 0.2.1.16-rc - 2009-06-20
o Security fixes:
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index d8165e63bd..1419ae4665 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1591,28 +1591,42 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, bandwidth_weight_rule_t rule,
int32_t flags = 0;
uint32_t this_bw = 0;
if (statuses) {
- /* need to extract router info */
status = smartlist_get(sl, i);
if (router_digest_is_me(status->identity_digest))
me_idx = i;
router = router_get_by_digest(status->identity_digest);
is_exit = status->is_exit;
is_guard = status->is_possible_guard;
- if (router) {
- this_bw = router_get_advertised_bandwidth(router);
+ if (status->has_bandwidth) {
+ this_bw = status->bandwidth*1000;
} else { /* guess */
+ /* XXX022 once consensuses always list bandwidths, we can take
+ * this guessing business out. -RD */
is_known = 0;
flags = status->is_fast ? 1 : 0;
flags |= is_exit ? 2 : 0;
flags |= is_guard ? 4 : 0;
}
} else {
+ routerstatus_t *rs;
router = smartlist_get(sl, i);
+ rs = router_get_consensus_status_by_id(
+ router->cache_info.identity_digest);
if (router_digest_is_me(router->cache_info.identity_digest))
me_idx = i;
is_exit = router->is_exit;
is_guard = router->is_possible_guard;
- this_bw = router_get_advertised_bandwidth(router);
+ if (rs && rs->has_bandwidth) {
+ this_bw = rs->bandwidth*1000;
+ } else if (rs) { /* guess; don't trust the descriptor */
+ /* XXX022 once consensuses always list bandwidths, we can take
+ * this guessing business out. -RD */
+ is_known = 0;
+ flags = router->is_fast ? 1 : 0;
+ flags |= is_exit ? 2 : 0;
+ flags |= is_guard ? 4 : 0;
+ } else /* bridge or other descriptor not in our consensus */
+ this_bw = router_get_advertised_bandwidth(router);
}
if (is_exit)
bitarray_set(exit_bits, i);