Comparison

core/s2smanager.lua @ 976:17af9851c81d

core.s2smanager: Remove some debugging
author Matthew Wild <mwild1@gmail.com>
date Fri, 10 Apr 2009 10:36:01 +0100
parent 974:82f7261c0482
child 977:6f0bdf9e4dfb
comparison
equal deleted inserted replaced
975:452ff29e296d 976:17af9851c81d
13 local core_process_stanza = function(a, b) core_process_stanza(a, b); end 13 local core_process_stanza = function(a, b) core_process_stanza(a, b); end
14 local socket = require "socket"; 14 local socket = require "socket";
15 local format = string.format; 15 local format = string.format;
16 local t_insert, t_sort = table.insert, table.sort; 16 local t_insert, t_sort = table.insert, table.sort;
17 local get_traceback = debug.traceback; 17 local get_traceback = debug.traceback;
18 local tostring, pairs, ipairs, getmetatable, print, newproxy, error, tonumber 18 local tostring, pairs, ipairs, getmetatable, newproxy, error, tonumber
19 = tostring, pairs, ipairs, getmetatable, print, newproxy, error, tonumber; 19 = tostring, pairs, ipairs, getmetatable, newproxy, error, tonumber;
20 20
21 local idna_to_ascii = require "util.encodings".idna.to_ascii; 21 local idna_to_ascii = require "util.encodings".idna.to_ascii;
22 local connlisteners_get = require "net.connlisteners".get; 22 local connlisteners_get = require "net.connlisteners".get;
23 local wrapclient = require "net.server".wrapclient; 23 local wrapclient = require "net.server".wrapclient;
24 local modulemanager = require "core.modulemanager"; 24 local modulemanager = require "core.modulemanager";
35 local sha256_hash = require "util.hashes".sha256; 35 local sha256_hash = require "util.hashes".sha256;
36 36
37 local dialback_secret = sha256_hash(tostring{} .. math.random() .. socket.gettime(), true); 37 local dialback_secret = sha256_hash(tostring{} .. math.random() .. socket.gettime(), true);
38 38
39 local adns = require "net.adns"; 39 local adns = require "net.adns";
40
41 local debug = debug;
42 40
43 incoming_s2s = {}; 41 incoming_s2s = {};
44 local incoming_s2s = incoming_s2s; 42 local incoming_s2s = incoming_s2s;
45 43
46 module "s2smanager" 44 module "s2smanager"
210 208
211 local cl = connlisteners_get("xmppserver"); 209 local cl = connlisteners_get("xmppserver");
212 conn = wrapclient(conn, connect_host, connect_port, cl, cl.default_mode or 1, hosts[from_host].ssl_ctx, false ); 210 conn = wrapclient(conn, connect_host, connect_port, cl, cl.default_mode or 1, hosts[from_host].ssl_ctx, false );
213 host_session.conn = conn; 211 host_session.conn = conn;
214 212
215 log("debug", "conn wrapped")
216 -- Register this outgoing connection so that xmppserver_listener knows about it 213 -- Register this outgoing connection so that xmppserver_listener knows about it
217 -- otherwise it will assume it is a new incoming connection 214 -- otherwise it will assume it is a new incoming connection
218 cl.register_outgoing(conn, host_session); 215 cl.register_outgoing(conn, host_session);
219 216
220 log("debug", "outgoing registered")
221
222 local w = conn.write; 217 local w = conn.write;
223 host_session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(tostring(t)); end 218 host_session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(tostring(t)); end
224 219
225 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'>]], from_host, to_host)); 220 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'>]], from_host, to_host));
226 log("debug", "Connection attempt in progress..."); 221 log("debug", "Connection attempt in progress...");
227 print("foo")
228 return true; 222 return true;
229 end 223 end
230 224
231 function streamopened(session, attr) 225 function streamopened(session, attr)
232 local send = session.sends2s; 226 local send = session.sends2s;