Software / code / prosody
Comparison
plugins/mod_register.lua @ 7293:c4af754d1e1b
mod_register: Make sure only an on_evict function or nil is passed to util.cache
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 17 Mar 2016 22:25:56 +0100 |
| parent | 7037:5d52e4ee2ae1 |
| child | 7570:c61ea328fac2 |
comparison
equal
deleted
inserted
replaced
| 7291:688a7f5d3624 | 7293:c4af754d1e1b |
|---|---|
| 185 local throttle_cache = new_cache(throttle_cache_size, blacklist_overflow and function (ip, throttle) | 185 local throttle_cache = new_cache(throttle_cache_size, blacklist_overflow and function (ip, throttle) |
| 186 if not throttle:peek() then | 186 if not throttle:peek() then |
| 187 module:log("info", "Adding ip %s to registration blacklist", ip); | 187 module:log("info", "Adding ip %s to registration blacklist", ip); |
| 188 blacklisted_ips[ip] = true; | 188 blacklisted_ips[ip] = true; |
| 189 end | 189 end |
| 190 end); | 190 end or nil); |
| 191 | 191 |
| 192 local function check_throttle(ip) | 192 local function check_throttle(ip) |
| 193 if not throttle_max then return true end | 193 if not throttle_max then return true end |
| 194 local throttle = throttle_cache:get(ip); | 194 local throttle = throttle_cache:get(ip); |
| 195 if not throttle then | 195 if not throttle then |