]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Kill warn when picking bridges without bw weight
authorSebastian Hahn <sebastian@torproject.org>
Sun, 5 Sep 2010 05:43:03 +0000 (07:43 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Mon, 6 Sep 2010 16:44:11 +0000 (18:44 +0200)
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.

changes/bug1805 [new file with mode: 0644]
src/or/routerlist.c

diff --git a/changes/bug1805 b/changes/bug1805
new file mode 100644 (file)
index 0000000..fdd03fb
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Make sure we don't warn about not having bandwidth weights when
+      choosing bridges or other relays not in the consensus. Bugfix
+      on 0.2.2.10-alpha; fixes bug 1805.
index 8808f56db90dc87b921311487b27fc5ee295c8ee..a153bc1782650962f341c2ce6b9a526cf6fe6dbf 100644 (file)
@@ -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);
   }