# HG changeset patch # User Georg Lukas # Date 1554214751 -7200 # Node ID 4d8a68557941b4e76ced80ea40c088ff7fdaaad5 # Parent 1b45bac50f3d6695a3501de26bfcec7bc3e979e9 mod_throttle_unsolicited: reduce debug logs, rename firewall mark diff -r 1b45bac50f3d -r 4d8a68557941 mod_throttle_unsolicited/mod_throttle_unsolicited.lua --- 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