bufferevent_ratelim.c


Log

Author Commit Date CI Message
Nick Mathewson 9c8db0f8 2010-09-23T22:45:55 Fix all warnings in the main codebase flagged by -Wsigned-compare Remember, the code int is_less_than(int a, unsigned b) { return a < b; } is buggy, since the C integer promotion rules basically turn it into int is_less_than(int a, unsigned b) { return ((unsigned)a) < b; } and we really want something closer to int is_less_than(int a, unsigned b) { return a < 0 || ((unsigned)a) < b; } . Suggested by an example from Ralph Castain
Nick Mathewson 0bffe43a 2010-08-09T12:08:40 Fix a nasty dangling-event bug when using rate-limiting groups When we freed a bufferevent that was in a rate-limiting group and blocked on IO, the process of freeing it caused it to get removed from the group. But removing the bufferevent from the group made its limits get removed, which could make it get un-suspended and in turn cause its events to get re-added. Since we would then immediately _free_ the events, this would result in dangling pointers. Fixes bug 3041007.
Nick Mathewson 6ae53d67 2010-08-04T15:44:08 Add an interface to expose min_share in ratelimiting groups
Nick Mathewson 08598709 2010-07-05T12:26:21 never let bufferevent_rlim functions return negative
Nick Mathewson fb366c1d 2010-03-21T13:16:31 Functions to track the total bytes sent over a rate limit group.
Nick Mathewson ee41aca6 2010-03-12T00:46:39 Functions to manipulate existing rate limiting groups. This patch adds a function to change the current rate limit of a rate limiting group, and another to free an empty rate limiting group.
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Nick Mathewson 162ce8a8 2010-02-23T00:38:30 Expose view of current rate limit as constrained by group limit
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson 85047a69 2010-02-03T15:12:04 Functions to view and manipulate rate-limiting buckets. We need these for Tor, and other projects probably need them too. Uses include: - Checking whether bandwidth is mostly-used, and only taking some actions when there's plenty of bandwidth. - Deducting some non-bufferevent activities from a rate-limit group.
Nick Mathewson ff3f6cd4 2010-01-22T16:14:49 Check more internal event_add() calls for failure Most of these should be unable to fail, since adding a timeout generally always works. Still, it's better not to try to be "too smart for our own good here." There are some remaining event_add() calls that I didn't add checks for; I've marked those with "XXXX" comments.
Nick Mathewson 165d30e3 2009-12-30T14:29:56 Fix compilation of rate-limiting code on win32.
Nick Mathewson 737c9cd8 2009-11-27T13:16:54 Rate-limiting for bufferevents; group and individual limits are supported. The fairness algorithms are not the best, not every bufferevent type is supported, and some of the locking tricks here are simply absurd. Still, this code should be a good first step.