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.
This commit is contained in:
Nick Mathewson 2013-04-11 10:24:11 -04:00
parent 922ab0883d
commit ec4ee3197f

View 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 */