11 pthread_mutex_init(&
_mutex, NULL);
16 pthread_mutex_destroy(&
_mutex);
39 uint64_t rate = (pRT->
count * 3600) / seconds;
48 pthread_mutex_lock(&
_mutex);
55 pthread_mutex_unlock(&
_mutex);
FastHashDynamic< RateTrackerAddress, RateTracker > _table
bool RateCheckImpl(const CSocketAddress &addr)
uint64_t get_rate(const RateTracker *pRT)
static const uint64_t MIN_COUNT_FOR_CONSIDERATION
int Insert(const K &key, V &value)
static const time_t RESET_INTERVAL_SECONDS
size_t GetIP(void *pAddr, size_t length) const
static const time_t PENALTY_TIME_SECONDS
static const uint64_t MAX_RATE
int InitTable(size_t fsize, size_t tsize)
RateLimiter(size_t tablesize, bool isUsingLock)
virtual time_t get_time()
bool RateCheck(const CSocketAddress &addr)