summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index cb93a81e4e..9dd92972e1 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2561,7 +2561,10 @@ connection_bucket_init(void)
burst = options->BandwidthBurst;
}
- rate /= TOR_LIBEVENT_TICKS_PER_SECOND;
+ /* This can't overflow, since TokenBucketRefillInterval <= 1000,
+ * and rate started out less than INT32_MAX. */
+ rate = (rate * options->TokenBucketRefillInterval) / 1000;
+
bucket_cfg = ev_token_bucket_cfg_new((uint32_t)rate, (uint32_t)burst,
(uint32_t)rate, (uint32_t)burst,
tick);