[tor-commits] [tor/master] Revert "Remove an erroneous 0.5 in compute_weighted_bandwidths()"

nickm at torproject.org nickm at torproject.org
Wed Nov 8 01:36:09 UTC 2017


commit 3dc61a5d71423e86d4d8090a90782a1ddf164880
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Nov 7 20:35:19 2017 -0500

    Revert "Remove an erroneous 0.5 in compute_weighted_bandwidths()"
    
    This reverts commit 01e984870a7e1db2722e85fe43af7bcb4755c2d4.
---
 changes/bug23318    | 7 -------
 src/or/routerlist.c | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/changes/bug23318 b/changes/bug23318
deleted file mode 100644
index 32c85eb19..000000000
--- a/changes/bug23318
+++ /dev/null
@@ -1,7 +0,0 @@
-  o Minor bugfixes (path selection):
-    - When selecting relays by bandwidth, avoid a rounding error that
-      could sometimes cause load to be imbalanced incorrectly. Previously,
-      we would always round upwards; now, we round towards the nearest
-      integer.  This had the biggest effect when a relay's weight adjustments
-      should have given it weight 0, but it got weight 1 instead.
-      Fixes bug 23318; bugfix on 0.2.4.3-alpha.
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f0bd343f4..c7c109253 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2706,7 +2706,7 @@ compute_weighted_bandwidths(const smartlist_t *sl,
       final_weight = weight*this_bw;
     }
 
-    bandwidths[node_sl_idx] = final_weight;
+    bandwidths[node_sl_idx] = final_weight + 0.5;
   } SMARTLIST_FOREACH_END(node);
 
   log_debug(LD_CIRC, "Generated weighted bandwidths for rule %s based "





More information about the tor-commits mailing list