libfilezilla
|
Context for rate_limiters. More...
#include <rate_limiter.hpp>
Public Member Functions | |
rate_limit_manager (event_loop &loop) | |
void | add (rate_limiter *limiter) |
Adds a limiter to the manager. More... | |
void | set_burst_tolerance (rate::type tolerance) |
Burst tolerance, a multiplier to bucket size, helps achieving the average rate on bursty connections. | |
Public Member Functions inherited from event_handler | |
event_handler (event_loop &loop) | |
event_handler (event_handler const &h) | |
event_handler & | operator= (event_handler const &)=delete |
void | remove_handler () |
Deactivates handler, removes all pending events and stops all timers for this handler. More... | |
template<typename T , typename... Args> | |
void | send_event (Args &&... args) |
Sends the passed event asynchronously to the handler. More... | |
template<typename T > | |
void | send_event (T *evt) |
timer_id | add_timer (monotonic_clock const &deadline, duration const &interval={}) |
Adds a timer, returns the timer id. More... | |
timer_id | add_timer (duration const &interval, bool one_shot) |
Adds a timer, returns the timer id. More... | |
void | stop_timer (timer_id id) |
timer_id | stop_add_timer (timer_id id, monotonic_clock const &deadline, duration const &interval={}) |
timer_id | stop_add_timer (timer_id id, duration const &interval, bool one_shot) |
Friends | |
class | rate_limiter |
class | bucket_base |
class | bucket |
Additional Inherited Members | |
Public Attributes inherited from event_handler | |
event_loop & | event_loop_ |
Context for rate_limiters.
Each active
This class implements the timer that periodically adds tokens to buckets. This timer is started and stopped automatically, it does not run when there is no activity to avoid unneeded CPU wakeups.
void add | ( | rate_limiter * | limiter | ) |
Adds a limiter to the manager.
Gets removed automatically when the limiter is destroyed, or manually when the limiter's remove_bucket
is called.