From b34345229a81cbb6b4278c93b26f6faf95886153 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sat, 10 Mar 2018 15:16:39 -0600 Subject: [PATCH] remove any peers from the dht if a reset is triggered (from coord changes) --- src/yggdrasil/dht.go | 6 ++++++ src/yggdrasil/router.go | 1 + 2 files changed, 7 insertions(+) diff --git a/src/yggdrasil/dht.go b/src/yggdrasil/dht.go index f4c85789..f7226624 100644 --- a/src/yggdrasil/dht.go +++ b/src/yggdrasil/dht.go @@ -485,3 +485,9 @@ func dht_firstCloserThanThird(first *NodeID, } return false } + +func (t *dht) resetPeers() { + for _, b := range t.buckets_hidden { + b.peers = b.peers[:0] + } +} diff --git a/src/yggdrasil/router.go b/src/yggdrasil/router.go index a9de9663..5028b493 100644 --- a/src/yggdrasil/router.go +++ b/src/yggdrasil/router.go @@ -80,6 +80,7 @@ func (r *router) mainLoop() { r.core.dht.insertIfNew(info, true) case <-r.reset: r.core.sessions.resetInits() + r.core.dht.resetPeers() case <-ticker.C: { // Any periodic maintenance stuff goes here