s2smanager: Send reply stream header only after checking we serve this host (sorry darkrain... :) )

Thu, 17 Dec 2009 21:36:31 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 17 Dec 2009 21:36:31 +0000
changeset 2780
f8232abcab2a
parent 2779
87b66be6d514
child 2781
4b5881b6bbfc

s2smanager: Send reply stream header only after checking we serve this host (sorry darkrain... :) )

core/s2smanager.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Thu Dec 17 19:01:57 2009 +0000
+++ b/core/s2smanager.lua	Thu Dec 17 21:36:31 2009 +0000
@@ -369,17 +369,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());
 		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

mercurial