mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-07-31 06:33:43 +00:00
add callbacks to maintenance map cleanup
This commit is contained in:
@@ -293,6 +293,11 @@ func (t *dht) doMaintenance() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.reqs = newReqs
|
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 {
|
for infoID, info := range t.table {
|
||||||
if now.Sub(info.recv) > time.Minute || info.pings > 3 {
|
if now.Sub(info.recv) > time.Minute || info.pings > 3 {
|
||||||
delete(t.table, infoID)
|
delete(t.table, infoID)
|
||||||
|
Reference in New Issue
Block a user