Software /
code /
prosody
Comparison
core/s2smanager.lua @ 2422:affeb565b050
s2smanager: Allow new_outgoing() to create sessions without automatically connecting them (set 3rd parameters to false)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 04 Jan 2010 17:32:26 +0000 |
parent | 2421:83773aed9437 |
child | 2426:4cef9808662a |
comparison
equal
deleted
inserted
replaced
2421:83773aed9437 | 2422:affeb565b050 |
---|---|
146 session:close("connection-timeout"); | 146 session:close("connection-timeout"); |
147 end); | 147 end); |
148 return session; | 148 return session; |
149 end | 149 end |
150 | 150 |
151 function new_outgoing(from_host, to_host) | 151 function new_outgoing(from_host, to_host, connect) |
152 local host_session = { to_host = to_host, from_host = from_host, host = from_host, | 152 local host_session = { to_host = to_host, from_host = from_host, host = from_host, |
153 notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; | 153 notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; |
154 | 154 |
155 hosts[from_host].s2sout[to_host] = host_session; | 155 hosts[from_host].s2sout[to_host] = host_session; |
156 | 156 |
159 local conn_name = "s2sout"..tostring(host_session):match("[a-f0-9]*$"); | 159 local conn_name = "s2sout"..tostring(host_session):match("[a-f0-9]*$"); |
160 log = logger_init(conn_name); | 160 log = logger_init(conn_name); |
161 host_session.log = log; | 161 host_session.log = log; |
162 end | 162 end |
163 | 163 |
164 -- Kick the connection attempting machine | 164 if connect ~= false then |
165 attempt_connection(host_session); | 165 -- Kick the connection attempting machine into life |
166 attempt_connection(host_session); | |
167 end | |
166 | 168 |
167 if not host_session.sends2s then | 169 if not host_session.sends2s then |
168 -- A sends2s which buffers data (until the stream is opened) | 170 -- A sends2s which buffers data (until the stream is opened) |
169 -- note that data in this buffer will be sent before the stream is authed | 171 -- note that data in this buffer will be sent before the stream is authed |
170 -- and will not be ack'd in any way, successful or otherwise | 172 -- and will not be ack'd in any way, successful or otherwise |