Changeset

10500:493cbfe99b64

mod_s2s: Fix name conflict introduced in c7864f970969
author Kim Alvefur <zash@zash.se>
date Tue, 10 Dec 2019 17:43:26 +0100
parents 10499:79c568d4146c
children 10501:e8186aba1583
files plugins/mod_s2s/mod_s2s.lua
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Mon Dec 09 16:39:48 2019 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Tue Dec 10 17:43:26 2019 +0100
@@ -506,23 +506,23 @@
 			end
 		end
 		if reason then -- nil == no err, initiated by us, false == initiated by remote
+			local stream_error;
 			if type(reason) == "string" then -- assume stream error
-				reason = st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' });
+				stream_error = st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' });
 			elseif type(reason) == "table" and not st.is_stanza(reason) then
-				local stanza = st.stanza("stream:error"):tag(reason.condition or "undefined-condition", stream_xmlns_attr):up();
+				stream_error = st.stanza("stream:error"):tag(reason.condition or "undefined-condition", stream_xmlns_attr):up();
 				if reason.text then
-					stanza:tag("text", stream_xmlns_attr):text(reason.text):up();
+					stream_error:tag("text", stream_xmlns_attr):text(reason.text):up();
 				end
 				if reason.extra then
-					stanza:add_child(reason.extra);
+					stream_error:add_child(reason.extra);
 				end
-				reason = stanza;
 			end
-			if st.is_stanza(reason) then
+			if st.is_stanza(stream_error) then
 				-- to and from are never unknown on outgoing connections
 				log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s",
 					session.from_host or "(unknown host)" or session.ip, session.to_host or "(unknown host)", session.type, reason);
-				session.sends2s(reason);
+				session.sends2s(stream_error);
 			end
 		end