Changeset

8270:8b470cf497b7

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Tue, 26 Sep 2017 17:49:20 +0100
parents 8268:e21d82551e05 (current diff) 8269:25237002aba4 (diff)
children 8271:c09deab9989e
files
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_limits.lua	Tue Sep 26 17:24:25 2017 +0100
+++ b/plugins/mod_limits.lua	Tue Sep 26 17:49:20 2017 +0100
@@ -4,6 +4,7 @@
 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 @@
 		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);