mod_s2s: Restructure some code
authorKim Alvefur <zash@zash.se>
Tue, 05 Dec 2017 13:24:28 +0100
changeset 8466 d81ebb1ef5ce
parent 8465 60d508f411a1
child 8467 1a0b76b07b7a
mod_s2s: Restructure some code
plugins/mod_s2s/mod_s2s.lua
--- a/plugins/mod_s2s/mod_s2s.lua	Tue Dec 05 12:35:01 2017 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Tue Dec 05 13:24:28 2017 +0100
@@ -106,8 +106,15 @@
 			(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