diff --git a/internal/dns/dns.go b/internal/dns/dns.go index dc7d83d..4b8b398 100644 --- a/internal/dns/dns.go +++ b/internal/dns/dns.go @@ -428,7 +428,10 @@ func (s *Server) handleRequest(w dns.ResponseWriter, r *dns.Msg) { if idx > 0 { // re-order this upstream to the front of s.upstream. s.upstreamMu.Lock() - s.upstream = append(append([]string{u}, s.upstream[:idx]...), s.upstream[idx+1:]...) + // if the upstreams were reordered in the meantime leave them alone + if s.upstream[idx] == u { + s.upstream = append(append([]string{u}, s.upstream[:idx]...), s.upstream[idx+1:]...) + } s.upstreamMu.Unlock() } return