From 9937a6102e91daa80e82e30820128287af92b72f Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 25 Nov 2018 16:29:47 -0600 Subject: [PATCH] add callbacks to maintenance map cleanup --- src/yggdrasil/dht.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/yggdrasil/dht.go b/src/yggdrasil/dht.go index fd5ca585..e49e343a 100644 --- a/src/yggdrasil/dht.go +++ b/src/yggdrasil/dht.go @@ -293,6 +293,11 @@ func (t *dht) doMaintenance() { } } t.reqs = newReqs + newCallbacks := make(map[dhtReqKey][]func(*dhtRes), len(t.callbacks)) + for key, callback := range t.callbacks { + newCallbacks[key] = callback + } + t.callbacks = newCallbacks for infoID, info := range t.table { if now.Sub(info.recv) > time.Minute || info.pings > 3 { delete(t.table, infoID)