summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2010-01-12 23:10:45 -0500
committerRoger Dingledine <arma@torproject.org>2010-01-15 15:56:54 -0500
commit045081322730e87df61cc1749575e3ec4d7955a8 (patch)
tree261f5ae84dbef7d53ed541554f6b42a7a4a03070
parent50e8210943db2cab3a04e23731969b07c366935c (diff)
downloadtor-045081322730e87df61cc1749575e3ec4d7955a8.tar.gz
tor-045081322730e87df61cc1749575e3ec4d7955a8.zip
resolve path weighting edge case; fixes bug 1203
-rw-r--r--src/or/routerlist.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 72b890b9fd..d7546a7a8b 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1752,6 +1752,8 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, bandwidth_weight_rule_t rule,
/* Almost done: choose a random value from the bandwidth weights. */
rand_bw = crypto_rand_uint64(total_bw);
+ rand_bw++; /* crypto_rand_uint64() counts from 0, and we need to count
+ * from 1 below. See bug 1203 for details. */
/* Last, count through sl until we get to the element we picked */
tmp = 0;