From c3b653b1b912c8eb11c5f0ed7d3d9da3715856dc Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 8 Aug 2015 22:01:45 +0100 Subject: [PATCH] ignore DuplicateError when inserting mDNS answer in zone When we issue two concurrent mDNS queries for the same name, the answer to the second one encounters a DuplicateError when inserting into the zone. We would return that error, which causes the query would fail. And we'd cache that fact. All bad. So ignore DuplicateError. Fixes #1270. --- nameserver/zone_lookup.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nameserver/zone_lookup.go b/nameserver/zone_lookup.go index 5c5aacd6..00d5aee0 100644 --- a/nameserver/zone_lookup.go +++ b/nameserver/zone_lookup.go @@ -103,9 +103,11 @@ func (zone *ZoneDb) domainLookup(target string, lfun ZoneLookupFunc) (res []Zone for _, answer := range lanswers { r, err := remoteIdent.addIPToName(answer, now) if err != nil { - zone.mx.Unlock() - Warning.Printf("[zonedb] '%s' insertion for %s failed: %s", answer, target, err) - return nil, err + if _, ok := err.(DuplicateError); !ok { + zone.mx.Unlock() + Warning.Printf("[zonedb] '%s' insertion for %s failed: %s", answer, target, err) + return nil, err + } } uniq.add(r) }