![]() |
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. | |
![]() | |
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 (duration const &interval, bool one_shot) |
Adds a timer, returns the timer id. More... | |
void | stop_timer (timer_id id) |
Friends | |
class | rate_limiter |
class | bucket_base |
class | bucket |
Additional Inherited Members | |
![]() | |
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.