summaryrefslogtreecommitdiff
path: root/bufferevent-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-08-11 15:15:17 -0400
committerNick Mathewson <nickm@torproject.org>2011-08-11 15:15:17 -0400
commit6d5440e80e7ecd95c52b3f3d5217e1693294404e (patch)
tree2320d8188e8bb116d337f65955cc1e1a0a114fc9 /bufferevent-internal.h
parent5d1b255b1475602707d61337107e2ab6e5a94da9 (diff)
downloadlibevent-6d5440e80e7ecd95c52b3f3d5217e1693294404e.tar.gz
Fix handling of group rate limits under 64 bytes of burst
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
Diffstat (limited to 'bufferevent-internal.h')
-rw-r--r--bufferevent-internal.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/bufferevent-internal.h b/bufferevent-internal.h
index 71711a36..dc471720 100644
--- a/bufferevent-internal.h
+++ b/bufferevent-internal.h
@@ -98,6 +98,8 @@ struct bufferevent_rate_limit_group {
/** The smallest number of bytes that any member of the group should
* be limited to read or write at a time. */
ev_ssize_t min_share;
+ ev_ssize_t configured_min_share;
+
/** Timeout event that goes off once a tick, when the bucket is ready
* to refill. */
struct event master_refill_event;