aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2017-09-26 17:49:20 +0100
committerMatthew Wild <mwild1@gmail.com>2017-09-26 17:49:20 +0100
commit5e5c698a9368fea84b4229749c4454ef4b80c6b2 (patch)
tree506223352c07b29149df4165cdf0149149d89574
parentd6833915bcfaeb6600c0af911102a8362e26e93e (diff)
parent14304764d845ced9c9d500f2c805f1d80227e07b (diff)
downloadprosody-5e5c698a9368fea84b4229749c4454ef4b80c6b2.tar.gz
prosody-5e5c698a9368fea84b4229749c4454ef4b80c6b2.zip
Merge 0.10->trunk
-rw-r--r--plugins/mod_limits.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/plugins/mod_limits.lua b/plugins/mod_limits.lua
index 2a6ee8a2..66341618 100644
--- a/plugins/mod_limits.lua
+++ b/plugins/mod_limits.lua
@@ -4,6 +4,7 @@ module:set_global();
local filters = require "util.filters";
local throttle = require "util.throttle";
local timer = require "util.timer";
+local ceil = math.ceil;
local limits_cfg = module:get_option("limits", {});
local limits_resolution = module:get_option_number("limits_resolution", 1);
@@ -55,6 +56,7 @@ function default_filter_set.bytes_in(bytes, session)
local ok, balance, outstanding = 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);
+ 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);