aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat_libevent.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-09-07 21:22:02 -0400
committerNick Mathewson <nickm@torproject.org>2011-09-22 15:07:34 -0400
commit052b95e2f196211c97b33ce8c68960e1c2561ea0 (patch)
treeda7ea13e5c6dd844dc4164c5bf83a509b579325e /src/common/compat_libevent.c
parent1e611846280b3198445e4e6d8fb56c426e452b7b (diff)
downloadtor-052b95e2f196211c97b33ce8c68960e1c2561ea0.tar
tor-052b95e2f196211c97b33ce8c68960e1c2561ea0.tar.gz
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.c')
0 files changed, 0 insertions, 0 deletions