From 40bfd207f56c26159322b7dbc6bd7a9b443a0c2e Mon Sep 17 00:00:00 2001 From: Arceliar Date: Mon, 25 May 2020 12:23:38 -0500 Subject: [PATCH 1/2] 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 From eefabb5f9fd128aa51350c9e81c6b771f2f32984 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Mon, 25 May 2020 12:44:06 -0500 Subject: [PATCH 2/2] disregard nodes if they're unimportant, even if they're already in the DHT --- src/yggdrasil/dht.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yggdrasil/dht.go b/src/yggdrasil/dht.go index 0b951c9..013fd1e 100644 --- a/src/yggdrasil/dht.go +++ b/src/yggdrasil/dht.go @@ -260,7 +260,7 @@ func (t *dht) handleRes(res *dhtRes) { key: res.Key, coords: res.Coords, } - if _, isIn := t.table[*rinfo.getNodeID()]; isIn || t.isImportant(&rinfo) { + if t.isImportant(&rinfo) { t.insert(&rinfo) } for _, info := range res.Infos {