Software /
code /
prosody
Comparison
core/s2smanager.lua @ 233:23585c323daa
Move some code about so that we don't leave connections hanging if they hit the connection timeout
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 09 Nov 2008 21:46:42 +0000 |
parent | 231:24bcdaacc0bf |
child | 241:021ccf988f3b |
comparison
equal
deleted
inserted
replaced
232:20745f8f4cf1 | 233:23585c323daa |
---|---|
74 local host_session = { to_host = to_host, from_host = from_host, notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; | 74 local host_session = { to_host = to_host, from_host = from_host, notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; |
75 hosts[to_host] = host_session; | 75 hosts[to_host] = host_session; |
76 local cl = connlisteners_get("xmppserver"); | 76 local cl = connlisteners_get("xmppserver"); |
77 | 77 |
78 local conn, handler = socket.tcp() | 78 local conn, handler = socket.tcp() |
79 | |
80 | |
81 -- Register this outgoing connection so that xmppserver_listener knows about it | |
82 -- otherwise it will assume it is a new incoming connection | |
83 cl.register_outgoing(conn, host_session); | |
84 | |
79 --FIXME: Below parameters (ports/ip) are incorrect (use SRV) | 85 --FIXME: Below parameters (ports/ip) are incorrect (use SRV) |
80 to_host = srvmap[to_host] or to_host; | 86 to_host = srvmap[to_host] or to_host; |
81 conn:settimeout(0.1); | 87 conn:settimeout(0.1); |
82 conn:connect(to_host, 5269); | 88 conn:connect(to_host, 5269); |
83 conn = wraptlsclient(cl, conn, to_host, 5269, 0, 1, hosts[from_host].ssl_ctx ); | 89 conn = wraptlsclient(cl, conn, to_host, 5269, 0, 1, hosts[from_host].ssl_ctx ); |
84 host_session.conn = conn; | 90 host_session.conn = conn; |
85 | |
86 -- Register this outgoing connection so that xmppserver_listener knows about it | |
87 -- otherwise it will assume it is a new incoming connection | |
88 cl.register_outgoing(conn, host_session); | |
89 | 91 |
90 do | 92 do |
91 local conn_name = "s2sout"..tostring(conn):match("[a-f0-9]*$"); | 93 local conn_name = "s2sout"..tostring(conn):match("[a-f0-9]*$"); |
92 host_session.log = logger_init(conn_name); | 94 host_session.log = logger_init(conn_name); |
93 end | 95 end |