From 58523060f02c7900ade6a2cc537a925f8d7de145 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 6 Nov 2015 17:12:06 +0100 Subject: [PATCH] Actually do negative caching on failed discovery lookups (fixes #2434) --- lib/discover/cache.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/discover/cache.go b/lib/discover/cache.go index a4809b9d..0ccfab1f 100644 --- a/lib/discover/cache.go +++ b/lib/discover/cache.go @@ -109,6 +109,12 @@ func (m *CachingMux) Lookup(deviceID protocol.DeviceID) (direct []string, relays when: time.Now(), found: len(td)+len(tr) > 0, }) + } else { + // Lookup returned error, add a negative cache entry. + m.caches[i].Set(deviceID, CacheEntry{ + when: time.Now(), + found: false, + }) } } m.mut.Unlock()