Changeset

3188:5c3f3f5a4377

Backed out parts of changeset a81456a13797
author Kim Alvefur <zash@zash.se>
date Wed, 18 Jul 2018 15:57:13 +0200
parents 3187:7c450c27d4ba
children 3189:57332ea0c1c7
files mod_auth_ldap/mod_auth_ldap.lua mod_muc_limits/mod_muc_limits.lua
diffstat 2 files changed, 1 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/mod_auth_ldap/mod_auth_ldap.lua	Fri Jul 13 14:38:40 2018 +0200
+++ b/mod_auth_ldap/mod_auth_ldap.lua	Wed Jul 18 15:57:13 2018 +0200
@@ -35,18 +35,9 @@
 	local success, iterator, invariant, initial = pcall(ld[method], ld, ...);
 	if not success then ld = nil; return nil, iterator, "search"; end
 
-	module:log("debug", "success = %s, invariant = %s",
-		tostring(success),
-		tostring(invariant));
-
 	local success, dn, attr = pcall(iterator, invariant, initial);
-	module:log("debug", "success = %s, dn = %s, attr = %s",
-		tostring(success),
-		tostring(dn),
-		tostring(attr));
 	if not success then ld = nil; return success, dn, "iter"; end
 
-
 	return dn, attr, "return";
 end
 
--- a/mod_muc_limits/mod_muc_limits.lua	Fri Jul 13 14:38:40 2018 +0200
+++ b/mod_muc_limits/mod_muc_limits.lua	Wed Jul 18 15:57:13 2018 +0200
@@ -25,18 +25,6 @@
 	dropped_jids = nil;
 end
 
-local function get_non_outcast_affiliations(room)
-	local nmembers = 0;
-	-- this is an evil hack, we probably should not access _affiliations
-	-- directly ...
-	for _, aff in pairs(room._affiliations) do
-		if aff ~= "outcast" then
-			nmembers = nmembers + 1;
-		end
-	end
-	return nmembers;
-end
-
 local function handle_stanza(event)
 	local origin, stanza = event.origin, event.stanza;
 	if stanza.name == "presence" and stanza.attr.type == "unavailable" then -- Don't limit room leaving
@@ -61,15 +49,7 @@
 		throttle = new_throttle(period*burst, burst);
 		room.throttle = throttle;
 	end
-
-	local cost = 1;
-	-- we scale the cost by the inverse of the square root of the number of
-	-- members; this should effectively raise the limit by a factor of
-	-- sqrt(nmembers)
-	local nmembers = math.max(get_non_outcast_affiliations(room), 1);
-	cost = cost / math.sqrt(nmembers);
-
-	if not throttle:poll(cost) then
+	if not throttle:poll(1) then
 		module:log("debug", "Dropping stanza for %s@%s from %s, over rate limit", dest_room, dest_host, from_jid);
 		if not dropped_jids then
 			dropped_jids = { [from_jid] = true, from_jid };