Explorar el Código

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.
Nick Mathewson hace 11 años
padre
commit
ec4ee3197f
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/or/dirserv.c

+ 2 - 2
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 */