Comparison

net/resolvers/service.lua @ 10121:33f287519bf6

net.resolvers.service: Fix DNS fallback
author Kim Alvefur <zash@zash.se>
date Sat, 17 Aug 2019 15:40:52 +0200
parent 9691:e11e076f0eb8
child 10386:cf93a951da37
comparison
equal deleted inserted replaced
10120:756b8821007a 10121:33f287519bf6
31 self:next(cb); 31 self:next(cb);
32 end 32 end
33 33
34 -- Resolve DNS to target list 34 -- Resolve DNS to target list
35 local dns_resolver = adns.resolver(); 35 local dns_resolver = adns.resolver();
36 dns_resolver:lookup(function (answer) 36 dns_resolver:lookup(function (answer, err)
37 if not answer and not err then
38 -- net.adns returns nil if there are zero records or nxdomain
39 answer = {};
40 end
37 if answer then 41 if answer then
38 if #answer == 0 then 42 if #answer == 0 then
39 if self.extra and self.extra.default_port then 43 if self.extra and self.extra.default_port then
40 table.insert(targets, { self.hostname, self.extra.default_port, self.conn_type, self.extra }); 44 table.insert(targets, { self.hostname, self.extra.default_port, self.conn_type, self.extra });
41 end 45 end