Software /
code /
prosody
Changeset
8803:60e113f3682f
mod_limits: Rename variable to avoid name clash [luacheck]
FIXME better name, s_throttle doesn't seem nice
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 02 May 2018 13:58:28 +0200 |
parents | 8802:befffddf1b25 |
children | 8804:c12eb919db3b |
files | plugins/mod_limits.lua |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_limits.lua Fri May 18 15:20:32 2018 +0100 +++ b/plugins/mod_limits.lua Wed May 02 13:58:28 2018 +0200 @@ -51,18 +51,18 @@ local default_filter_set = {}; function default_filter_set.bytes_in(bytes, session) - local throttle = session.throttle; - if throttle then - local ok, balance, outstanding = throttle:poll(#bytes, true); + local sess_throttle = session.throttle; + if sess_throttle then + local ok, balance, outstanding = sess_throttle:poll(#bytes, true); if not ok then - session.log("debug", "Session over rate limit (%d) with %d (by %d), pausing", throttle.max, #bytes, outstanding); + session.log("debug", "Session over rate limit (%d) with %d (by %d), pausing", sess_throttle.max, #bytes, outstanding); outstanding = ceil(outstanding); session.conn:pause(); -- Read no more data from the connection until there is no outstanding data local outstanding_data = bytes:sub(-outstanding); bytes = bytes:sub(1, #bytes-outstanding); timer.add_task(limits_resolution, function () if not session.conn then return; end - if throttle:peek(#outstanding_data) then + if sess_throttle:peek(#outstanding_data) then session.log("debug", "Resuming paused session"); session.conn:resume(); end