5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-09-19 16:09:36 +00:00

don't store every node we hear from in the DHT, only ones we already know about or that are important

This commit is contained in:
Arceliar 2020-05-25 12:23:38 -05:00
parent 169b8747d4
commit 40bfd207f5

View File

@ -260,7 +260,9 @@ func (t *dht) handleRes(res *dhtRes) {
key: res.Key,
coords: res.Coords,
}
t.insert(&rinfo)
if _, isIn := t.table[*rinfo.getNodeID()]; isIn || t.isImportant(&rinfo) {
t.insert(&rinfo)
}
for _, info := range res.Infos {
if *info.getNodeID() == t.nodeID {
continue