diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-09-07 22:00:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-09-22 15:07:34 -0400 |
commit | 41dfc4c19c4e0ee37d092fa0ed7faf349e6ab467 (patch) | |
tree | 621914608ae5e2031a044448ee3c07d68144dbb6 /src/or/connection.c | |
parent | 052b95e2f196211c97b33ce8c68960e1c2561ea0 (diff) | |
download | tor-41dfc4c19c4e0ee37d092fa0ed7faf349e6ab467.tar.gz tor-41dfc4c19c4e0ee37d092fa0ed7faf349e6ab467.zip |
Make bufferevents work with TokenBucketRefillInterval
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 5 |
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); |