diff options
author | lash <nolash@users.noreply.github.com> | 2019-02-28 15:12:50 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2019-02-28 15:12:50 +0800 |
commit | 62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd (patch) | |
tree | d9f0c0bc74f29c36e30b9a9395da7bacf2dc8b42 /swarm/network/simulation/kademlia.go | |
parent | 505a49e689683f11326ef30af3b9bcff8f3c2b8f (diff) | |
download | go-tangerine-62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd.tar go-tangerine-62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd.tar.gz go-tangerine-62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd.tar.bz2 go-tangerine-62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd.tar.lz go-tangerine-62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd.tar.xz go-tangerine-62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd.tar.zst go-tangerine-62d9d638582fa5fd7bcfaa55e8810fcfb898a4dd.zip |
swarm/network: WIP consider all nodes for healthy iteration (#19155)
* swarm/network: WIP consider all nodes for healthy iteration
* swarm/network/simulation: extend TestWaitTillHealthy to really check kads are healthy
* cmd/swarm/swarm-snapshot: fixed bugs in snapshot creation binary
* swarm/network/simulation: addressed PR comments
* swarm/network/simulation: defer sim.Clsoe()
* swarm/network/simulation: fixed wrong sim.Close()
* swarm/network/simulation: addressed PR comments
* cmd/swarm/swarm-snapshot: reducing default to 8 nodes, more to 4
* cmd/swarm/swarm-snapshot: extended timeout to 3 mins, or 256 nodes snapshot times out
* swarm/network/simulation: More PR comments
Diffstat (limited to 'swarm/network/simulation/kademlia.go')
-rw-r--r-- | swarm/network/simulation/kademlia.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/swarm/network/simulation/kademlia.go b/swarm/network/simulation/kademlia.go index c58d402b0..a3419c03f 100644 --- a/swarm/network/simulation/kademlia.go +++ b/swarm/network/simulation/kademlia.go @@ -58,7 +58,7 @@ func (s *Simulation) WaitTillHealthy(ctx context.Context) (ill map[enode.ID]*net for k := range ill { delete(ill, k) } - log.Debug("kademlia health check", "addr count", len(addrs)) + log.Debug("kademlia health check", "addr count", len(addrs), "kad len", len(kademlias)) for id, k := range kademlias { //PeerPot for this node addr := common.Bytes2Hex(k.BaseAddr()) @@ -70,7 +70,7 @@ func (s *Simulation) WaitTillHealthy(ctx context.Context) (ill map[enode.ID]*net log.Debug("kademlia", "connectNN", h.ConnectNN, "knowNN", h.KnowNN) log.Debug("kademlia", "health", h.ConnectNN && h.KnowNN, "addr", hex.EncodeToString(k.BaseAddr()), "node", id) log.Debug("kademlia", "ill condition", !h.ConnectNN, "addr", hex.EncodeToString(k.BaseAddr()), "node", id) - if !h.ConnectNN { + if !h.Healthy() { ill[id] = k } } @@ -85,6 +85,7 @@ func (s *Simulation) WaitTillHealthy(ctx context.Context) (ill map[enode.ID]*net // in simulation bucket. func (s *Simulation) kademlias() (ks map[enode.ID]*network.Kademlia) { items := s.UpNodesItems(BucketKeyKademlia) + log.Debug("kademlia len items", "len", len(items)) ks = make(map[enode.ID]*network.Kademlia, len(items)) for id, v := range items { k, ok := v.(*network.Kademlia) |