Comparison

net/resolvers/service.lua @ 9392:f2d71e4284b7

net.resolvers.service: Understand when service is explicitly unavailable RFC2782 states: > A Target of "." means that the service is decidedly not available at > this domain.
author Kim Alvefur <zash@zash.se>
date Sat, 29 Sep 2018 21:56:47 +0200
parent 9388:a5d11627ce5d
child 9393:e2733f504d9e
comparison
equal deleted inserted replaced
9391:4001eb3f465a 9392:f2d71e4284b7
32 32
33 -- Resolve DNS to target list 33 -- Resolve DNS to target list
34 local dns_resolver = adns.resolver(); 34 local dns_resolver = adns.resolver();
35 dns_resolver:lookup(function (answer) 35 dns_resolver:lookup(function (answer)
36 if answer then 36 if answer then
37 if #answer == 1 and answer[1].srv.target == "." then -- No service here
38 ready();
39 return;
40 end
41
37 table.sort(answer, function (a, b) return a.priority > b.priority end); 42 table.sort(answer, function (a, b) return a.priority > b.priority end);
38 for _, record in ipairs(answer) do 43 for _, record in ipairs(answer) do
39 table.insert(targets, { record.srv.target, record.srv.port, self.conn_type, self.extra }); 44 table.insert(targets, { record.srv.target, record.srv.port, self.conn_type, self.extra });
40 end 45 end
41 end 46 end