Comparison

plugins/mod_s2s/s2sout.lib.lua @ 6917:65344c3bae7a

mod_s2s/s2sout: Keep SRV lookup response around even if it's empty
author Kim Alvefur <zash@zash.se>
date Thu, 05 Nov 2015 13:54:35 +0100
parent 6685:3f05b255937f
child 7098:5286e79c6829
comparison
equal deleted inserted replaced
6916:d0ab0069145f 6917:65344c3bae7a
101 log("debug", "First attempt to connect to %s, starting with SRV lookup...", to_host); 101 log("debug", "First attempt to connect to %s, starting with SRV lookup...", to_host);
102 host_session.connecting = true; 102 host_session.connecting = true;
103 local handle; 103 local handle;
104 handle = adns.lookup(function (answer) 104 handle = adns.lookup(function (answer)
105 handle = nil; 105 handle = nil;
106 local srv_hosts = { answer = answer };
107 host_session.srv_hosts = srv_hosts;
108 host_session.srv_choice = 0;
106 host_session.connecting = nil; 109 host_session.connecting = nil;
107 if answer and #answer > 0 then 110 if answer and #answer > 0 then
108 log("debug", "%s has SRV records, handling...", to_host); 111 log("debug", "%s has SRV records, handling...", to_host);
109 local srv_hosts = { answer = answer };
110 host_session.srv_hosts = srv_hosts;
111 for _, record in ipairs(answer) do 112 for _, record in ipairs(answer) do
112 t_insert(srv_hosts, record.srv); 113 t_insert(srv_hosts, record.srv);
113 end 114 end
114 if #srv_hosts == 1 and srv_hosts[1].target == "." then 115 if #srv_hosts == 1 and srv_hosts[1].target == "." then
115 log("debug", "%s does not provide a XMPP service", to_host); 116 log("debug", "%s does not provide a XMPP service", to_host);