5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 00:11: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, key: res.Key,
coords: res.Coords, coords: res.Coords,
} }
if _, isIn := t.table[*rinfo.getNodeID()]; isIn || t.isImportant(&rinfo) {
t.insert(&rinfo) t.insert(&rinfo)
}
for _, info := range res.Infos { for _, info := range res.Infos {
if *info.getNodeID() == t.nodeID { if *info.getNodeID() == t.nodeID {
continue continue