[tor-commits] [tor/master] Remove bogus comment claiming that an assertion is triggerable by consensus

nickm at torproject.org nickm at torproject.org
Fri Aug 3 15:41:10 UTC 2012


commit 82c5e385cbddec4fd80618d6e96111ad73d5a22e
Author: Robert Ransom <rransom.8774 at gmail.com>
Date:   Thu Jun 14 15:41:11 2012 +0000

    Remove bogus comment claiming that an assertion is triggerable by consensus
---
 src/or/routerlist.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index de1a66c..37de70f 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1983,9 +1983,10 @@ smartlist_choose_node_by_bandwidth(smartlist_t *sl,
     if (is_guard)
       bitarray_set(guard_bits, i);
     if (is_known) {
-      bandwidths[i] = (int32_t) this_bw; // safe since MAX_BELIEVABLE<INT32_MAX
-      // XXX this is no longer true! We don't always cap the bw anymore. Can
-      // a consensus make us overflow?-sh
+      bandwidths[i] = (int32_t) this_bw;
+      /* Casting this_bw to int32_t is safe because both kb_to_bytes
+         and bridge_get_advertised_bandwidth_bounded limit it to below
+         INT32_MAX. */
       tor_assert(bandwidths[i] >= 0);
       if (is_guard)
         total_guard_bw += this_bw;





More information about the tor-commits mailing list