summaryrefslogtreecommitdiff
path: root/bufferevent_ratelim.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates to 2011.Nick Mathewson2011-10-241-1/+1
|
* Support negative arguments to _bufferevent_decrement_(read/write)_buckets()Nick Mathewson2011-08-281-0/+14
|
* Make rate limiting work with common_timeout logicNick Mathewson2011-08-241-1/+4
|
* Fix handling of group rate limits under 64 bytes of burstNick Mathewson2011-08-111-1/+15
| | | | | | | | | | | | | | The "min_share" logic, which was designed to prevent piles of extremely small writes when running up against a group rate limit, could lead to confusing behavior if you ever set a min_share less than your burst rate. If that happened, then as soon as your group rate limit was exhausted, you'd stop reading/writing, and never start again, since the amount readable/writeable would never actually hit min_share. We now cap min_share at the rate per tick. Found by George Kadianakis
* Try to clear up more size_t vs int/long issues.Nick Mathewson2010-10-271-6/+6
|
* Make rate-limits go up to SIZE_MAX/EV_SSIZE_MAX, not just INT32_MAXNick Mathewson2010-10-261-10/+15
| | | | | | | | Someday, when networks are far faster and people frequently want a burst value greater than 2GB per tick, this will seem very forsightful indeed. For now, it breaks ABI, but not source. Fixes bug 3092096.
* Fix serious bugs in per-bufferevent rate-limiting codeNick Mathewson2010-10-121-20/+45
| | | | | | | | | | | | | | Our old code was too zealous about deleting the refill events that would actually make connections able to read or write again after they had run out of bandwidth. Under some circumstances, this could cause a bufferevent to never actually refill one of its rate-limiting buckets. Also, the code treated setting a per-connection rate-limit on a connection that already had a group-limit as if it were changing the limit on a connection whose allocation had already run out. This patch fixes both of those problems.
* Fix all warnings in the main codebase flagged by -Wsigned-compareNick Mathewson2010-09-231-5/+8
| | | | | | | | | | | | | | | | | | 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
* Fix a nasty dangling-event bug when using rate-limiting groupsNick Mathewson2010-08-091-2/+11
| | | | | | | | | | | | 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.
* Add an interface to expose min_share in ratelimiting groupsNick Mathewson2010-08-041-0/+8
|
* never let bufferevent_rlim functions return negativeNick Mathewson2010-07-051-0/+2
|
* Functions to track the total bytes sent over a rate limit group.Nick Mathewson2010-03-211-0/+18
|
* Functions to manipulate existing rate limiting groups.Nick Mathewson2010-03-121-0/+40
| | | | | 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.
* Update all our copyright notices to say "2010"Nick Mathewson2010-03-041-1/+1
|
* Expose view of current rate limit as constrained by group limitNick Mathewson2010-02-231-0/+21
|
* Clean up formatting: use tabs, not 8-spaces, to indent.Nick Mathewson2010-02-181-3/+3
|
* Functions to view and manipulate rate-limiting buckets.Nick Mathewson2010-02-031-33/+220
| | | | | | | | 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.
* Check more internal event_add() calls for failureNick Mathewson2010-01-221-6/+14
| | | | | | | | | 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.
* Fix compilation of rate-limiting code on win32.Nick Mathewson2009-12-301-1/+1
|
* Rate-limiting for bufferevents; group and individual limits are supported.Nick Mathewson2009-12-281-0/+654
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.