Merge with backout branch

Thu, 17 Dec 2009 21:38:16 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 17 Dec 2009 21:38:16 +0000
changeset 2381
7926f513816b
parent 2380
1c7839fbbe9d (diff)
parent 2378
bc1ae371ad54 (current diff)
child 2382
5e37e28a429f

Merge with backout branch

core/s2smanager.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Thu Dec 17 21:18:02 2009 +0000
+++ b/core/s2smanager.lua	Thu Dec 17 21:38:16 2009 +0000
@@ -363,17 +363,17 @@
 	
 		session.streamid = uuid_gen();
 		(session.log or log)("debug", "incoming s2s received <stream:stream>");
-		send("<?xml version='1.0'?>");
-		send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', 
-				["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, version=(session.version > 0 and "1.0" or nil) }):top_tag());
-		session.notopen = nil;
 		if session.to_host and not hosts[session.to_host] then
 			-- Attempting to connect to a host we don't serve
 			session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host });
 			return;
 		end
+		send("<?xml version='1.0'?>");
+		send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', 
+				["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, version=(session.version > 0 and "1.0" or nil) }):top_tag());
 		if session.version >= 1.0 then
 			local features = st.stanza("stream:features");
+			
 			if session.to_host then
 				hosts[session.to_host].events.fire_event("s2s-stream-features", { session = session, features = features });
 			else
@@ -390,7 +390,7 @@
 	
 		-- Send unauthed buffer
 		-- (stanzas which are fine to send before dialback)
-		-- Note that this is *not* the stanza queue (which
+		-- Note that this is *not* the stanza queue (which 
 		-- we can only send if auth succeeds) :)
 		local send_buffer = session.send_buffer;
 		if send_buffer and #send_buffer > 0 then
@@ -412,6 +412,7 @@
 			end
 		end
 	end
+	session.notopen = nil;
 end
 
 function streamclosed(session)
@@ -478,6 +479,7 @@
 			end
 			session.sendq = nil;
 		end
+		
 		session.srv_hosts = nil;
 	end
 end

mercurial