From 42648438a01c7f42d4b3d2846aa1d395ccef9f35 Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 29 Jul 2015 17:16:48 -0400 Subject: [PATCH] Check NXDOMAIN after filtering nodes Move the check for NXDOMAIN below the service health filter. --- command/agent/dns.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/command/agent/dns.go b/command/agent/dns.go index 15c343228d..7940102e3c 100644 --- a/command/agent/dns.go +++ b/command/agent/dns.go @@ -478,13 +478,6 @@ RPC: goto RPC } - // If we have no nodes, return not found! - if len(out.Nodes) == 0 { - d.addSOA(d.domain, resp) - resp.SetRcode(req, dns.RcodeNameError) - return - } - // Determine the TTL var ttl time.Duration if d.config.ServiceTTL != nil { @@ -498,6 +491,13 @@ RPC: // Filter out any service nodes due to health checks out.Nodes = d.filterServiceNodes(out.Nodes) + // If we have no nodes, return not found! + if len(out.Nodes) == 0 { + d.addSOA(d.domain, resp) + resp.SetRcode(req, dns.RcodeNameError) + return + } + // Perform a random shuffle shuffleServiceNodes(out.Nodes)