diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-09-07 21:22:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-09-22 15:07:34 -0400 |
commit | 052b95e2f196211c97b33ce8c68960e1c2561ea0 (patch) | |
tree | da7ea13e5c6dd844dc4164c5bf83a509b579325e /src/common/compat_libevent.h | |
parent | 1e611846280b3198445e4e6d8fb56c426e452b7b (diff) | |
download | tor-052b95e2f196211c97b33ce8c68960e1c2561ea0.tar.gz tor-052b95e2f196211c97b33ce8c68960e1c2561ea0.zip |
Refactor connection_bucket_refill(_helper) to avoid roundoff
We were doing "divide bandwidth by 1000, then multiply by msec", but
that would lose accuracy: instead of getting your full bandwidth,
you'd lose up to 999 bytes per sec. (Not a big deal, but every byte
helps.)
Instead, do the multiply first, then the division. This can easily
overflow a 32-bit value, so make sure to do it as a 64-bit operation.
Diffstat (limited to 'src/common/compat_libevent.h')
0 files changed, 0 insertions, 0 deletions