From 40bfd207f56c26159322b7dbc6bd7a9b443a0c2e Mon Sep 17 00:00:00 2001 From: Arceliar Date: Mon, 25 May 2020 12:23:38 -0500 Subject: [PATCH] don't store every node we hear from in the DHT, only ones we already know about or that are important --- src/yggdrasil/dht.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/yggdrasil/dht.go b/src/yggdrasil/dht.go index 8efc549..0b951c9 100644 --- a/src/yggdrasil/dht.go +++ b/src/yggdrasil/dht.go @@ -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