Check NXDOMAIN after filtering nodes

Move the check for NXDOMAIN below the service health filter.
This commit is contained in:
Ryan Breen 2015-07-29 17:16:48 -04:00
parent 8ec5a0b5ba
commit 42648438a0
1 changed files with 7 additions and 7 deletions

View File

@ -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)