aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-13 21:17:54 +0100
committerKim Alvefur <zash@zash.se>2021-12-13 21:17:54 +0100
commit50b57fb062ac2cacce513c682c82ad7315953863 (patch)
tree82820bafc2ba39f03bb26a553e2a7bb11f5ab5ab /plugins
parentd7fa4fadcf6d04715dbd94ed58d3de697bd66031 (diff)
downloadprosody-50b57fb062ac2cacce513c682c82ad7315953863.tar.gz
prosody-50b57fb062ac2cacce513c682c82ad7315953863.zip
mod_smacks: Back out a86ae74da96c: Fixed one problem, caused another
As per a86ae74da96c the 'session' object here is the wrong session, so the attempt to block stanzas from being added to the queue twice did not work causing something of a leak. Instead we have a leak of the previous session.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_smacks.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua
index 8f231474..104b75af 100644
--- a/plugins/mod_smacks.lua
+++ b/plugins/mod_smacks.lua
@@ -198,14 +198,14 @@ local function outgoing_stanza_filter(stanza, session)
-- supposed to be nil.
-- However, when using mod_smacks with mod_websocket, then mod_websocket's
-- stanzas/out filter can get called before this one and adds the xmlns.
- if session.resending_unacked then return stanza end
local is_stanza = st.is_stanza(stanza) and
(not stanza.attr.xmlns or stanza.attr.xmlns == 'jabber:client')
and not stanza.name:find":";
- if is_stanza then
+ if is_stanza and not stanza._cached then
local queue = session.outgoing_stanza_queue;
local cached_stanza = st.clone(stanza);
+ cached_stanza._cached = true;
if cached_stanza.name ~= "iq" and cached_stanza:get_child("delay", xmlns_delay) == nil then
cached_stanza = cached_stanza:tag("delay", {
@@ -600,11 +600,9 @@ function handle_resume(session, stanza, xmlns_sm)
-- to the outgoing queue again
local queue = original_session.outgoing_stanza_queue;
session.log("debug", "resending all unacked stanzas that are still queued after resume, #queue = %d", #queue);
- session.resending_unacked = true;
for i=1,#queue do
session.send(queue[i]);
end
- session.resending_unacked = nil;
session.log("debug", "all stanzas resent, now disabling send() in this migrated session, #queue = %d", #queue);
function session.send(stanza) -- luacheck: ignore 432
migrated_session_log("error", "Tried to send stanza on old session migrated by smacks resume (maybe there is a bug?): %s", tostring(stanza));