jabberd2
2.2.17
|
#include "util.h"
Go to the source code of this file.
Functions | |
rate_t | rate_new (int total, int seconds, int wait) |
void | rate_free (rate_t rt) |
void | rate_reset (rate_t rt) |
void | rate_add (rate_t rt, int count) |
Add a number of events to the counter. | |
int | rate_left (rate_t rt) |
int | rate_check (rate_t rt) |
rate_t rate_new | ( | int | total, |
int | seconds, | ||
int | wait | ||
) |
Definition at line 25 of file rate.c.
References rate_st::seconds, rate_st::total, and rate_st::wait.
Referenced by _c2s_client_accept_check(), _c2s_client_mio_callback(), _router_accept_check(), router_mio_callback(), and sm_storage_rate_limit().
void rate_free | ( | rate_t | rt | ) |
Definition at line 36 of file rate.c.
Referenced by _c2s_client_accept_check(), JABBER_MAIN(), router_mio_callback(), and sm_storage_rate_limit().
void rate_reset | ( | rate_t | rt | ) |
Definition at line 41 of file rate.c.
References rate_st::bad, rate_st::count, and rate_st::time.
Referenced by rate_add(), and rate_check().
void rate_add | ( | rate_t | rt, |
int | count | ||
) |
Add a number of events to the counter.
This takes care of moving the sliding window, if we've moved outside the previous window.
Definition at line 48 of file rate.c.
References rate_st::bad, rate_st::count, rate_reset(), rate_st::seconds, rate_st::time, and rate_st::total.
Referenced by _c2s_client_accept_check(), _c2s_client_sx_callback(), _router_accept_check(), _router_sx_callback(), and sm_storage_rate_limit().
int rate_left | ( | rate_t | rt | ) |
Definition at line 69 of file rate.c.
References rate_st::bad, rate_st::count, and rate_st::total.
Referenced by _c2s_client_sx_callback(), and _router_sx_callback().
int rate_check | ( | rate_t | rt | ) |
Definition at line 78 of file rate.c.
References rate_st::bad, rate_st::count, rate_reset(), rate_st::time, rate_st::total, and rate_st::wait.
Referenced by _c2s_client_accept_check(), _c2s_client_sx_callback(), _c2s_time_checks(), _router_accept_check(), _router_sx_callback(), and sm_storage_rate_limit().