summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-11-06 09:49:06 -0500
committerNick Mathewson <nickm@torproject.org>2017-11-06 09:49:06 -0500
commit8c9b5bfb8c0d933fb76e41bb2f6790bd6185b8ff (patch)
tree8bc3bc229f47e34c8629b135ec8697099f6dfd3a
parent6bc1632b724da0593b0d781998bece33a0b6cec6 (diff)
parentc80293706fe16c052efef6653079163fc117029a (diff)
downloadtor-8c9b5bfb8c0d933fb76e41bb2f6790bd6185b8ff.tar.gz
tor-8c9b5bfb8c0d933fb76e41bb2f6790bd6185b8ff.zip
Merge branch 'maint-0.3.2' into release-0.3.2
-rw-r--r--changes/bug233187
-rw-r--r--src/or/routerlist.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/changes/bug23318 b/changes/bug23318
new file mode 100644
index 0000000000..32c85eb194
--- /dev/null
+++ b/changes/bug23318
@@ -0,0 +1,7 @@
+ 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 c7c1092539..f0bd343f45 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 + 0.5;
+ bandwidths[node_sl_idx] = final_weight;
} SMARTLIST_FOREACH_END(node);
log_debug(LD_CIRC, "Generated weighted bandwidths for rule %s based "