Software / code / prosody
Comparison
plugins/mod_limits.lua @ 10551:27b275633156
mod_limits: Remove an unused variable
Hope this isn't meant to be used. 'outstanding' seems to be the more
useful value anyways?
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 23 Dec 2019 22:24:31 +0100 |
| parent | 10111:0f335815244f |
| child | 11560:3bbb1af92514 |
comparison
equal
deleted
inserted
replaced
| 10550:0566b45da987 | 10551:27b275633156 |
|---|---|
| 51 local default_filter_set = {}; | 51 local default_filter_set = {}; |
| 52 | 52 |
| 53 function default_filter_set.bytes_in(bytes, session) | 53 function default_filter_set.bytes_in(bytes, session) |
| 54 local sess_throttle = session.throttle; | 54 local sess_throttle = session.throttle; |
| 55 if sess_throttle then | 55 if sess_throttle then |
| 56 local ok, balance, outstanding = sess_throttle:poll(#bytes, true); | 56 local ok, _, outstanding = sess_throttle:poll(#bytes, true); |
| 57 if not ok then | 57 if not ok then |
| 58 session.log("debug", "Session over rate limit (%d) with %d (by %d), pausing", sess_throttle.max, #bytes, outstanding); | 58 session.log("debug", "Session over rate limit (%d) with %d (by %d), pausing", sess_throttle.max, #bytes, outstanding); |
| 59 outstanding = ceil(outstanding); | 59 outstanding = ceil(outstanding); |
| 60 session.conn:pause(); -- Read no more data from the connection until there is no outstanding data | 60 session.conn:pause(); -- Read no more data from the connection until there is no outstanding data |
| 61 local outstanding_data = bytes:sub(-outstanding); | 61 local outstanding_data = bytes:sub(-outstanding); |