[tor-commits] [tor/master] Use correct units for dirserv_get_{credible_bandwidth, bandwidth_for_router}

nickm at torproject.org nickm at torproject.org
Mon Apr 15 01:58:00 UTC 2013


commit ec4ee3197fb0891a094a5fc4860c0b94eefee3c7
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Apr 11 10:24:11 2013 -0400

    Use correct units for dirserv_get_{credible_bandwidth,bandwidth_for_router}
    
    We were mixing bandwidth file entries (which are in kilobytes) with
    router_get_advertised_bw() entries, which were in bytes.
    
    Also, use router_get_advertised_bandwidth_capped() for credible_bandwidth.
---
 src/or/dirserv.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index e837e4b..ed19406 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2214,7 +2214,7 @@ dirserv_get_bandwidth_for_router(const routerinfo_t *ri)
       bw = (uint32_t)mbw;
     } else {
       /* If not, fall back to advertised */
-      bw = router_get_advertised_bandwidth(ri);
+      bw = router_get_advertised_bandwidth(ri) / 1000;
     }
   }
 
@@ -2263,7 +2263,7 @@ dirserv_get_credible_bandwidth(const routerinfo_t *ri)
       bw = 0;
     } else {
       /* Return an advertised bandwidth otherwise */
-      bw = router_get_advertised_bandwidth(ri);
+      bw = router_get_advertised_bandwidth_capped(ri) / 1000;
     }
   } else {
     /* We have the measured bandwidth in mbw */





More information about the tor-commits mailing list