# HG changeset patch # User Kim Alvefur # Date 1588976890 -7200 # Node ID 4a9ff4f617965dae37c83d7027c58cb5ebfc8eb0 # Parent 3bd846c767013565935299d5a80df257814e7232 mod_presence: Send unavailable presence in current thread run `session:dispatch_stanza(pres)` enqueues processing of the stanza in the sessions async thread, but becasue the entire stream close handling is now in that thread it would process the presence after the stream and session was completely closed, leading to weird errors "sent to a resting session". We call core_process_stanza() since this is what :dispatch_stanza calls in the end. diff -r 3bd846c76701 -r 4a9ff4f61796 plugins/mod_presence.lua --- a/plugins/mod_presence.lua Sat May 09 00:07:42 2020 +0200 +++ b/plugins/mod_presence.lua Sat May 09 00:28:10 2020 +0200 @@ -14,6 +14,7 @@ local tonumber = tonumber; local core_post_stanza = prosody.core_post_stanza; +local core_process_stanza = prosody.core_process_stanza; local st = require "util.stanza"; local jid_split = require "util.jid".split; local jid_bare = require "util.jid".bare; @@ -370,7 +371,7 @@ if err then pres:tag("status"):text("Disconnected: "..err):up(); end - session:dispatch_stanza(pres); + core_process_stanza(session, pres); elseif session.directed then local pres = st.presence{ type = "unavailable", from = session.full_jid }; if err then