]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use correct units for dirserv_get_{credible_bandwidth,bandwidth_for_router}
authorNick Mathewson <nickm@torproject.org>
Thu, 11 Apr 2013 14:24:11 +0000 (10:24 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 11 Apr 2013 14:26:17 +0000 (10:26 -0400)
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

index e837e4bed5a769e667ddc81fa9ebda06197b2ca6..ed19406bae5aba3c770a06afffd4ed24c903b895 100644 (file)
@@ -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 */