aboutsummaryrefslogtreecommitdiffstats
path: root/net/resolvers/service.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-09-29 21:56:47 +0200
committerKim Alvefur <zash@zash.se>2018-09-29 21:56:47 +0200
commit06b75d8153078e81e0b87a4da43e8c029882fd70 (patch)
tree8a54939b4497f30d732755d22707de41a48213aa /net/resolvers/service.lua
parentd18f2f7521989989f19f8af817f9af0ff0a40db7 (diff)
downloadprosody-06b75d8153078e81e0b87a4da43e8c029882fd70.tar.gz
prosody-06b75d8153078e81e0b87a4da43e8c029882fd70.zip
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.
Diffstat (limited to 'net/resolvers/service.lua')
-rw-r--r--net/resolvers/service.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/resolvers/service.lua b/net/resolvers/service.lua
index 736a838b..036317e5 100644
--- a/net/resolvers/service.lua
+++ b/net/resolvers/service.lua
@@ -34,6 +34,11 @@ function methods:next(cb)
local dns_resolver = adns.resolver();
dns_resolver:lookup(function (answer)
if answer then
+ if #answer == 1 and answer[1].srv.target == "." then -- No service here
+ ready();
+ return;
+ end
+
table.sort(answer, function (a, b) return a.priority > b.priority end);
for _, record in ipairs(answer) do
table.insert(targets, { record.srv.target, record.srv.port, self.conn_type, self.extra });