[or-cvs] [tor/master 7/9] resolve path weighting edge case; fixes bug 1203

arma at torproject.org arma at torproject.org
Fri Jan 15 22:35:03 UTC 2010


Author: Roger Dingledine <arma at torproject.org>
Date: Tue, 12 Jan 2010 23:10:45 -0500
Subject: resolve path weighting edge case; fixes bug 1203
Commit: 045081322730e87df61cc1749575e3ec4d7955a8

---
 src/or/routerlist.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 72b890b..d7546a7 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;
-- 
1.6.5




More information about the tor-commits mailing list