Changeset

10121:33f287519bf6

net.resolvers.service: Fix DNS fallback
author Kim Alvefur <zash@zash.se>
date Sat, 17 Aug 2019 15:40:52 +0200
parents 10120:756b8821007a
children 10210:9fdda9fafc3c
files net/resolvers/service.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/resolvers/service.lua	Sat Nov 10 13:37:32 2018 +0100
+++ b/net/resolvers/service.lua	Sat Aug 17 15:40:52 2019 +0200
@@ -33,7 +33,11 @@
 
 	-- 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