aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-12-05 13:24:28 +0100
committerKim Alvefur <zash@zash.se>2017-12-05 13:24:28 +0100
commit5389a3a5cfd741173841344e03ec9195144042df (patch)
treed354b4a205cf98ffc59218e702948938febeec6d
parente803ffc6fee0183f95aeeb0631d9e3d46ca6e0cf (diff)
downloadprosody-5389a3a5cfd741173841344e03ec9195144042df.tar.gz
prosody-5389a3a5cfd741173841344e03ec9195144042df.zip
mod_s2s: Restructure some code
-rw-r--r--plugins/mod_s2s/mod_s2s.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index a63892a5..0c1d7783 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -106,8 +106,15 @@ function route_to_existing_session(event)
(host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host);
-- Queue stanza until we are able to send it
- if host.sendq then t_insert(host.sendq, {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)});
- else host.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; end
+ local queued_item = {
+ tostring(stanza),
+ stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza);
+ };
+ if host.sendq then
+ t_insert(host.sendq, queued_item);
+ else
+ host.sendq = { queued_item };
+ end
host.log("debug", "stanza [%s] queued ", stanza.name);
return true;
elseif host.type == "local" or host.type == "component" then