diff options
author | lash <nolash@users.noreply.github.com> | 2018-12-22 13:53:30 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2018-12-22 13:53:30 +0800 |
commit | 5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3 (patch) | |
tree | ea38f47b568dbd0841a1e4e4fd51105d5f26a0e2 /swarm/network/simulation/kademlia.go | |
parent | 880de230b44e20282abdef0f1f9a3294ce68e5d8 (diff) | |
download | dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar.gz dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar.bz2 dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar.lz dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar.xz dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar.zst dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.zip |
swarm/network: Revised depth and health for Kademlia (#18354)
* swarm/network: Revised depth calculation with tests
* swarm/network: WIP remove redundant "full" function
* swarm/network: WIP peerpot refactor
* swarm/network: Make test methods submethod of peerpot and embed kad
* swarm/network: Remove commented out code
* swarm/network: Rename health test functions
* swarm/network: Too many n's
* swarm/network: Change hive Healthy func to accept addresses
* swarm/network: Add Healthy proxy method for api in hive
* swarm/network: Skip failing test out of scope for PR
* swarm/network: Skip all tests dependent on SuggestPeers
* swarm/network: Remove commented code and useless kad Pof member
* swarm/network: Remove more unused code, add counter on depth test errors
* swarm/network: WIP Create Healthy assertion tests
* swarm/network: Roll back health related methods receiver change
* swarm/network: Hardwire network minproxbinsize in swarm sim
* swarm/network: Rework Health test to strict
Pending add test for saturation
And add test for as many as possible up to saturation
* swarm/network: Skip discovery tests (dependent on SuggestPeer)
* swarm/network: Remove useless minProxBinSize in stream
* swarm/network: Remove unnecessary testing.T param to assert health
* swarm/network: Implement t.Helper() in checkHealth
* swarm/network: Rename check back to assert now that we have helper magic
* swarm/network: Revert WaitTillHealthy change (deferred to nxt PR)
* swarm/network: Kademlia tests GotNN => ConnectNN
* swarm/network: Renames and comments
* swarm/network: Add comments
Diffstat (limited to 'swarm/network/simulation/kademlia.go')
-rw-r--r-- | swarm/network/simulation/kademlia.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/swarm/network/simulation/kademlia.go b/swarm/network/simulation/kademlia.go index 7982810ca..25bb0f6a9 100644 --- a/swarm/network/simulation/kademlia.go +++ b/swarm/network/simulation/kademlia.go @@ -39,6 +39,7 @@ func (s *Simulation) WaitTillHealthy(ctx context.Context, kadMinProxSize int) (i var ppmap map[string]*network.PeerPot kademlias := s.kademlias() addrs := make([][]byte, 0, len(kademlias)) + // TODO verify that all kademlias have same params for _, k := range kademlias { addrs = append(addrs, k.BaseAddr()) } @@ -66,10 +67,10 @@ func (s *Simulation) WaitTillHealthy(ctx context.Context, kadMinProxSize int) (i h := k.Healthy(pp) //print info log.Debug(k.String()) - log.Debug("kademlia", "empty bins", pp.EmptyBins, "gotNN", h.GotNN, "knowNN", h.KnowNN, "full", h.Full) - log.Debug("kademlia", "health", h.GotNN && h.KnowNN && h.Full, "addr", hex.EncodeToString(k.BaseAddr()), "node", id) - log.Debug("kademlia", "ill condition", !h.GotNN || !h.Full, "addr", hex.EncodeToString(k.BaseAddr()), "node", id) - if !h.GotNN || !h.Full { + 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 { ill[id] = k } } |