Changeset

8463:d81ebb1ef5ce

mod_s2s: Restructure some code
author Kim Alvefur <zash@zash.se>
date Tue, 05 Dec 2017 13:24:28 +0100
parents 8462:60d508f411a1
children 8464:1a0b76b07b7a
files plugins/mod_s2s/mod_s2s.lua
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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