Tor 0.4.9.0-alpha-dev
Data Structures | Macros | Functions
ratelim.h File Reference

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

#include <time.h>

Go to the source code of this file.

Data Structures

struct  ratelim_t
 

Macros

#define RATELIM_INIT(r)   { (r), 0, 0, 0 }
 
#define RATELIM_TOOMANY   (16*1000*1000)
 

Functions

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.h.

Macro Definition Documentation

◆ RATELIM_INIT

#define RATELIM_INIT (   r)    { (r), 0, 0, 0 }

Definition at line 55 of file ratelim.h.

◆ RATELIM_TOOMANY

#define RATELIM_TOOMANY   (16*1000*1000)

Definition at line 57 of file ratelim.h.

Function Documentation

◆ 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.