summaryrefslogtreecommitdiff
path: root/ratelim-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-09 12:08:40 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-09 12:08:40 -0400
commit0bffe43a15fbd43bc7826acb88a3bada528c8adf (patch)
treef3f4ce3467227d47693f9b334ef7175790424e39 /ratelim-internal.h
parentff481a8e43999c4ba1556bc472b5e69fce7ea353 (diff)
downloadlibevent-0bffe43a15fbd43bc7826acb88a3bada528c8adf.tar.gz
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.
Diffstat (limited to 'ratelim-internal.h')
-rw-r--r--ratelim-internal.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/ratelim-internal.h b/ratelim-internal.h
index a47e2408..d60f6376 100644
--- a/ratelim-internal.h
+++ b/ratelim-internal.h
@@ -84,6 +84,9 @@ int ev_token_bucket_init(struct ev_token_bucket *bucket,
ev_uint32_t current_tick,
int reinitialize);
+int bufferevent_remove_from_rate_limit_group_internal(struct bufferevent *bev,
+ int unsuspend);
+
/** Decrease the read limit of 'b' by 'n' bytes */
#define ev_token_bucket_decrement_read(b,n) \
do { \