Diff

plugins/mod_s2s/mod_s2s.lua @ 6685:3f05b255937f

Merge 0.9->0.10
author Kim Alvefur <zash@zash.se>
date Wed, 13 May 2015 22:31:59 +0200
parent 6658:65563530375b
parent 6684:53635a91c95c
child 6690:b2e89583d6e6
child 6846:7eb166fa1f26
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Wed May 13 16:57:27 2015 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Wed May 13 22:31:59 2015 +0200
@@ -166,7 +166,7 @@
 
 -- Stream is authorised, and ready for normal stanzas
 function mark_connected(session)
-	local sendq, send = session.sendq, session.sends2s;
+	local sendq = session.sendq;
 
 	local from, to = session.from_host, session.to_host;
 
@@ -189,6 +189,7 @@
 	if session.direction == "outgoing" then
 		if sendq then
 			session.log("debug", "sending %d queued stanzas across new outgoing connection to %s", #sendq, session.to_host);
+			local send = session.sends2s;
 			for i, data in ipairs(sendq) do
 				send(data[1]);
 				sendq[i] = nil;
@@ -258,8 +259,6 @@
 local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
 
 function stream_callbacks.streamopened(session, attr)
-	local send = session.sends2s;
-
 	session.version = tonumber(attr.version) or 0;
 
 	-- TODO: Rename session.secure to session.encrypted
@@ -342,6 +341,7 @@
 		end
 
 		session:open_stream(session.to_host, session.from_host)
+		session.notopen = nil;
 		if session.version >= 1.0 then
 			local features = st.stanza("stream:features");
 
@@ -352,9 +352,8 @@
 			end
 
 			log("debug", "Sending stream features: %s", tostring(features));
-			send(features);
+			session.sends2s(features);
 		end
-		session.notopen = nil;
 	elseif session.direction == "outgoing" then
 		session.notopen = nil;
 		if not attr.id then