Comparison

core/s2smanager.lua @ 2133:5c1758ccf8b9

Merge with trunk
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 04:50:42 +0000
parent 2127:be3c906f4770
parent 2101:74e90854a4dd
child 2134:9044e7cfefc2
comparison
equal deleted inserted replaced
2131:72411e239221 2133:5c1758ccf8b9
126 getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; end; 126 getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; end;
127 end 127 end
128 open_sessions = open_sessions + 1; 128 open_sessions = open_sessions + 1;
129 local w, log = conn.write, logger_init("s2sin"..tostring(conn):match("[a-f0-9]+$")); 129 local w, log = conn.write, logger_init("s2sin"..tostring(conn):match("[a-f0-9]+$"));
130 session.log = log; 130 session.log = log;
131 session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(conn, tostring(t)); end 131 session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^([^>]*>?)"); w(conn, tostring(t)); end
132 incoming_s2s[session] = true; 132 incoming_s2s[session] = true;
133 add_task(connect_timeout, function () 133 add_task(connect_timeout, function ()
134 if session.conn ~= conn or 134 if session.conn ~= conn or
135 session.type == "s2sin" then 135 session.type == "s2sin" then
136 return; -- Ok, we're connect[ed|ing] 136 return; -- Ok, we're connect[ed|ing]
315 -- Register this outgoing connection so that xmppserver_listener knows about it 315 -- Register this outgoing connection so that xmppserver_listener knows about it
316 -- otherwise it will assume it is a new incoming connection 316 -- otherwise it will assume it is a new incoming connection
317 cl.register_outgoing(conn, host_session); 317 cl.register_outgoing(conn, host_session);
318 318
319 local w, log = conn.write, host_session.log; 319 local w, log = conn.write, host_session.log;
320 host_session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(conn, tostring(t)); end 320 host_session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?")); w(conn, tostring(t)); end
321 321
322 conn:write(format([[<stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback' xmlns:stream='http://etherx.jabber.org/streams' from='%s' to='%s' version='1.0' xml:lang='en'>]], from_host, to_host)); 322 conn:write(format([[<stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback' xmlns:stream='http://etherx.jabber.org/streams' from='%s' to='%s' version='1.0' xml:lang='en'>]], from_host, to_host));
323 log("debug", "Connection attempt in progress..."); 323 log("debug", "Connection attempt in progress...");
324 add_task(connect_timeout, function () 324 add_task(connect_timeout, function ()
325 if host_session.conn ~= conn or 325 if host_session.conn ~= conn or