aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_presence.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-05-09 00:28:10 +0200
committerKim Alvefur <zash@zash.se>2020-05-09 00:28:10 +0200
commit71d6bde69ce86526dda8b0ee7c14b3418c415a7f (patch)
treec3fd9da76632bd87c05f67fe25370a3bd58d7595 /plugins/mod_presence.lua
parent6b456feb2939af36b454f8b53b0bda32f3aa7613 (diff)
downloadprosody-71d6bde69ce86526dda8b0ee7c14b3418c415a7f.tar.gz
prosody-71d6bde69ce86526dda8b0ee7c14b3418c415a7f.zip
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.
Diffstat (limited to 'plugins/mod_presence.lua')
-rw-r--r--plugins/mod_presence.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index d6e2b2b7..3f9a0c12 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -14,6 +14,7 @@ local s_find = string.find;
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 @@ module:hook("resource-unbind", function(event)
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