Browse Source

token bucket: Add parens to rate_per_sec_to_rate_per_step()

Typecasts bind more tightly than division, so we need to do the
division first.
Nick Mathewson 6 years ago
parent
commit
2bf6f1cd39
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/common/token_bucket.c

+ 1 - 1
src/common/token_bucket.c

@@ -119,7 +119,7 @@ rate_per_sec_to_rate_per_step(uint32_t rate)
   */
   uint64_t units = (uint64_t) rate * TICKS_PER_STEP;
   uint32_t val = (uint32_t)
-    monotime_coarse_stamp_units_to_approx_msec(units) / 1000;
+    (monotime_coarse_stamp_units_to_approx_msec(units) / 1000);
   return val ? val : 1;
 }