106 local host_session = { to_host = to_host, from_host = from_host, notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; |
106 local host_session = { to_host = to_host, from_host = from_host, notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; |
107 hosts[from_host].s2sout[to_host] = host_session; |
107 hosts[from_host].s2sout[to_host] = host_session; |
108 |
108 |
109 local log; |
109 local log; |
110 do |
110 do |
111 local conn_name = "s2sout"..tostring(conn):match("[a-f0-9]*$"); |
111 local conn_name = "s2sout"..tostring(host_session):match("[a-f0-9]*$"); |
112 log = logger_init(conn_name); |
112 log = logger_init(conn_name); |
113 host_session.log = log; |
113 host_session.log = log; |
114 end |
114 end |
115 |
115 |
116 attempt_connection(host_session); |
116 attempt_connection(host_session); |
178 end |
178 end |
179 |
179 |
180 function streamopened(session, attr) |
180 function streamopened(session, attr) |
181 local send = session.sends2s; |
181 local send = session.sends2s; |
182 |
182 |
183 session.version = tonumber(attr.version) or 0; |
183 -- TODO: #29: SASL/TLS on s2s streams |
|
184 session.version = 0; --tonumber(attr.version) or 0; |
|
185 |
184 if session.version >= 1.0 and not (attr.to and attr.from) then |
186 if session.version >= 1.0 and not (attr.to and attr.from) then |
185 --print("to: "..tostring(attr.to).." from: "..tostring(attr.from)); |
187 --print("to: "..tostring(attr.to).." from: "..tostring(attr.from)); |
186 log("warn", (session.to_host or "(unknown)").." failed to specify 'to' or 'from' hostname as per RFC"); |
188 log("warn", (session.to_host or "(unknown)").." failed to specify 'to' or 'from' hostname as per RFC"); |
187 end |
189 end |
188 |
190 |