aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-22 15:29:15 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-22 15:29:15 -0400
commit01e984870a7e1db2722e85fe43af7bcb4755c2d4 (patch)
tree09653612a7faa2c5a53d35d83b7e39231b155752 /src/or/routerlist.c
parent2c93be80d9ad0712b5716c85e32f7a5184f3b1d2 (diff)
downloadtor-01e984870a7e1db2722e85fe43af7bcb4755c2d4.tar.gz
tor-01e984870a7e1db2722e85fe43af7bcb4755c2d4.zip
Remove an erroneous 0.5 in compute_weighted_bandwidths()
Back in 0.2.4.3-alpha (e106812a778f537), when we switched from using double to using uint64 for selecting by bandwidth, I got the math wrong: I should have used llround(x), or (uint64_t)(x+0.5), but instead I wrote llround(x+0.5). That means we would always round up, rather than rounding to the closest integer Fixes bug 23318; bugfix on 0.2.4.3-alpha.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 2365f28fd2..faf2eeda5d 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2713,7 +2713,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 "