Tor 0.4.9.8
Loading...
Searching...
No Matches
ratelim.c File Reference

Summarize similar messages that would otherwise flood the logs. More...

Go to the source code of this file.

Functions

static int rate_limit_is_ready (ratelim_t *lim, time_t now)
 
char * rate_limit_log (ratelim_t *lim, time_t now)
 

Detailed Description

Summarize similar messages that would otherwise flood the logs.

Definition in file ratelim.c.

Function Documentation

◆ rate_limit_is_ready()

static int rate_limit_is_ready ( ratelim_t * lim,
time_t now )
static

If the rate-limiter lim is ready at now, return the number of calls to rate_limit_is_ready (including this one!) since the last time rate_limit_is_ready returned nonzero. Otherwise return 0. If the call number hits RATELIM_TOOMANY limit, drop a warning about this event and stop counting.

Definition at line 22 of file ratelim.c.

Referenced by rate_limit_log().

◆ rate_limit_log()

char * rate_limit_log ( ratelim_t * lim,
time_t now )

If the rate-limiter lim is ready at now, return a newly allocated string indicating how many messages were suppressed, suitable to append to a log message. Otherwise return NULL.

Definition at line 42 of file ratelim.c.

Referenced by can_service_launch_intro_circuit(), circuit_get_open_circ_or_launch(), connection_ap_handshake_rewrite_and_attach(), get_unique_circ_id_by_chan(), handle_introduce1(), handle_relay_msg(), log_buggy_rs_source(), onion_pending_add(), pathbias_count_build_attempt(), pathbias_count_build_success(), pathbias_should_count(), and warn_consensus_is_not_reasonably_live().