changeset 3541:4d8a68557941

mod_throttle_unsolicited: reduce debug logs, rename firewall mark
author Georg Lukas <georg@op-co.de>
date Tue, 02 Apr 2019 16:19:11 +0200
parents 1b45bac50f3d
children 1bb2a90398d3
files mod_throttle_unsolicited/mod_throttle_unsolicited.lua
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_throttle_unsolicited/mod_throttle_unsolicited.lua	Mon Apr 01 13:19:47 2019 +0200
+++ b/mod_throttle_unsolicited/mod_throttle_unsolicited.lua	Tue Apr 02 16:19:11 2019 +0200
@@ -12,7 +12,6 @@
 function check_subscribed(event)
 	local stanza, origin = event.stanza, event.origin;
 	local log = origin.log or module._log;
-	log("debug", "check_subscribed(%s)", stanza:top_tag());
 	if stanza.attr.type == "error" then return end
 
 	local to_orig = stanza.attr.to;
@@ -25,24 +24,22 @@
 	-- Check if it's a message to a joined room
 	local rooms = origin.rooms_joined;
 	if rooms and rooms[to_bare] then
-		log("debug", "Message to joined room, no limit");
 		return
 	end
 
 	-- Retrieve or create throttle object
 	local lim = origin.throttle_unsolicited;
 	if not lim then
-		log("debug", "New throttle");
 		lim = throttle.create(max * multiplier, 60 * multiplier);
 		origin.throttle_unsolicited = lim;
 	end
 
 	local to_user, to_host = jid_split(to_orig);
 	if to_user and not is_contact_subscribed(to_user, to_host, from_jid) then
-		log("debug", "%s is not subscribed to %s@%s", from_jid, to_user, to_host);
+		log("debug", "[unsolicited] %s is not subscribed to %s@%s", from_jid, to_user, to_host);
 		if not lim:poll(1) then
-			log("warn", "Sent too many messages to non-contacts, bouncing message");
-			origin.firewall_mark_throttle_unsolicited = gettime();
+			log("warn", "[unsolicited] Sent too many messages to non-contacts, bouncing message");
+			origin.firewall_mark_unsolicited = gettime();
 			origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 			return true;
 		end