From 469ce79a49fabbe0d42115fa7a2f1a27e3bae3f1 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 17 Aug 2019 15:40:52 +0200 Subject: net.resolvers.service: Fix DNS fallback --- net/resolvers/service.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/resolvers/service.lua b/net/resolvers/service.lua index d1b8556c..62d269e5 100644 --- a/net/resolvers/service.lua +++ b/net/resolvers/service.lua @@ -33,7 +33,11 @@ function methods:next(cb) -- Resolve DNS to target list local dns_resolver = adns.resolver(); - dns_resolver:lookup(function (answer) + dns_resolver:lookup(function (answer, err) + if not answer and not err then + -- net.adns returns nil if there are zero records or nxdomain + answer = {}; + end if answer then if #answer == 0 then if self.extra and self.extra.default_port then -- cgit v1.2.3