From 303beead53c24cfc2b48a0873950f46beb6d8e58 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sun, 5 Sep 2010 07:43:03 +0200 Subject: Kill warn when picking bridges without bw weight Bridges and other relays not included in the consensus don't necessarily have a non-zero bandwidth capacity. If all our configured bridges had a zero bw capacity we would warn the user. Change that. --- src/or/routerlist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/or/routerlist.c') diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 8808f56db9..a153bc1782 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1586,6 +1586,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, double *bandwidths; double tmp = 0; unsigned int i; + int have_unknown = 0; /**< sl contains element not in consensus. */ /* Can't choose exit and guard at same time */ tor_assert(rule == NO_WEIGHTING || @@ -1702,6 +1703,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, this_bw = kb_to_bytes(rs->bandwidth); } else { /* bridge or other descriptor not in our consensus */ this_bw = router_get_advertised_bandwidth_capped(router); + have_unknown = 1; } if (router_digest_is_me(router->cache_info.identity_digest)) is_me = 1; @@ -1732,9 +1734,11 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, /* If there is no bandwidth, choose at random */ if (DBL_TO_U64(weighted_bw) == 0) { - log_warn(LD_CIRC, - "Weighted bandwidth is %lf in node selection for rule %s", - weighted_bw, bandwidth_weight_rule_to_string(rule)); + /* Dont't warn when using bridges/relays not in the consensus */ + if (!have_unknown) + log_warn(LD_CIRC, + "Weighted bandwidth is %lf in node selection for rule %s", + weighted_bw, bandwidth_weight_rule_to_string(rule)); tor_free(bandwidths); return smartlist_choose(sl); } -- cgit v1.2.3-54-g00ecf From 9c8fb75edf3e8025a71b806d35e550f89f3f0999 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 27 Sep 2010 12:23:49 -0400 Subject: Clean up some bug1805 comments based on arma's feedback --- src/or/routerlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/or/routerlist.c') diff --git a/src/or/routerlist.c b/src/or/routerlist.c index a153bc1782..909c0a2ae2 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1586,7 +1586,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, double *bandwidths; double tmp = 0; unsigned int i; - int have_unknown = 0; /**< sl contains element not in consensus. */ + int have_unknown = 0; /* true iff sl contains element not in consensus. */ /* Can't choose exit and guard at same time */ tor_assert(rule == NO_WEIGHTING || @@ -1734,7 +1734,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, /* If there is no bandwidth, choose at random */ if (DBL_TO_U64(weighted_bw) == 0) { - /* Dont't warn when using bridges/relays not in the consensus */ + /* Don't warn when using bridges/relays not in the consensus */ if (!have_unknown) log_warn(LD_CIRC, "Weighted bandwidth is %lf in node selection for rule %s", -- cgit v1.2.3-54-g00ecf