Commits

Thijs Alkemade committed 9e38d95

That tries to send <stream> before the socks5 handshake is done, do this instead.

Comments (0)

Files changed (1)

 
 		conn.setlistener(conn, listener);
 
-		local w, log = conn.send, session.log;
-
-		local filter = initialize_filters(session);
-
-		session.sends2s = function (t)
-			log("debug", "sending (socks5): %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?"));
-			if t.name then
-				t = filter("stanzas/out", t);
-			end
-			if t then
-				t = filter("bytes/out", tostring(t));
-				if t then
-					return w(conn, tostring(t));
-				end
-			end
-		end
-
 		listener.register_outgoing(conn, session);
 
-		session.sends2s(st.stanza("stream:stream", {
-			xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback',
-			["xmlns:stream"]='http://etherx.jabber.org/streams',
-			from=session.from_host, to=session.to_host, version='1.0', ["xml:lang"]='en'}):top_tag());
-
 		session.socks5_handler = nil;
 		session.socks5_buffer = nil;
 
+		s2sout.initiate_connection(hosts[conn.from_host].s2sout[conn.to_host]);
+		
 		listener.onconnect(conn);
 	end
 end
 
 	local host_session = s2s_new_outgoing(event.from_host, event.to_host);
 
-	s2sout.initiate_connection(host_session);
-
 	hosts[event.from_host].s2sout[event.to_host] = host_session;
 
 	connect_socks5(host_session, event.to_host, 5269);