5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 02:30:31 +00:00

don't add things to the dht rumorMill if they've been pinged in the last minute (arbitrary time, needs investigating)

This commit is contained in:
Arceliar 2018-03-17 15:28:22 -05:00
parent 96399d586d
commit fe5ef4e867

View File

@ -451,7 +451,7 @@ func (t *dht) doMaintenance() {
}
}
}
if oldest != nil {
if oldest != nil && time.Since(oldest.recv) > time.Minute {
t.addToMill(oldest, nil)
} // if the DHT isn't empty
// Refresh buckets
@ -460,8 +460,10 @@ func (t *dht) doMaintenance() {
}
target := t.getTarget(t.offset)
for _, info := range t.lookup(target) {
t.addToMill(info, target)
break
if time.Since(info.recv) > time.Minute {
t.addToMill(info, target)
break
}
}
t.offset++
}