Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit 72dae51

Browse files
committed
swarm/network: Cleanup after rebase on upstream cosmetic changes
1 parent b5cb505 commit 72dae51

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

swarm/network/kademlia.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,8 @@ type Health struct {
804804
ConnectNN bool // whether node is connected to all its neighbours
805805
CountConnectNN int // amount of neighbours connected to
806806
MissingConnectNN [][]byte // which neighbours we should have been connected to but we're not
807-
Saturated bool // whether we are connected to all the peers we would have liked to
807+
Potent bool // whether we are connected a mininum of peers for bins we know of peers
808+
Saturation int // whether we are connected to all the peers we would have liked to
808809
Hive string
809810
}
810811

@@ -819,20 +820,21 @@ type Health struct {
819820
func (k *Kademlia) Healthy(pp *PeerPot) *Health {
820821
k.lock.RLock()
821822
defer k.lock.RUnlock()
822-
connectnn, countconnectnn, culpritsconnectnn := k.connectedNeighbours(pp.NNSet)
823-
knownn, countknownn, culpritsknownn := k.knowNeighbours(pp.NNSet)
823+
connectnn, countconnectnn, missingconnectnn := k.connectedNeighbours(pp.NNSet)
824+
knownn, countknownn, missingknownn := k.knowNeighbours(pp.NNSet)
824825
impotentBins := k.connectedPotential()
825826
saturation := k.saturation()
826827
log.Trace(fmt.Sprintf("%08x: healthy: knowNNs: %v, connectNNs: %v, saturated: %v\n", k.base, knownn, connectnn, saturation))
827828
potent := countknownn == 0 || len(impotentBins) == 0
828829
return &Health{
829830
KnowNN: knownn,
830831
CountKnowNN: countknownn,
831-
MissingKnowNN: culpritsknownn,
832-
ConnectNN: gotnn,
833-
CountConnectNN: countgotnn,
834-
MissingConnectNN: culpritsgotnn,
835-
Saturated: saturated,
832+
MissingKnowNN: missingknownn,
833+
ConnectNN: connectnn,
834+
CountConnectNN: countconnectnn,
835+
MissingConnectNN: missingconnectnn,
836+
Potent: potent,
837+
Saturation: saturation,
836838
Hive: k.string(),
837839
}
838840
}

swarm/network/kademlia_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ func TestKademliaHiveString(t *testing.T) {
745745
Register(k, "10000000", "10000001")
746746
k.MaxProxDisplay = 8
747747
h := k.String()
748-
expH := "\n=========================================================================\nMon Feb 27 12:10:28 UTC 2017 KΛÐΞMLIΛ hive: queen's address: 000000\npopulation: 2 (4), MinProxBinSize: 2, MinBinSize: 1, MaxBinSize: 4\n============ DEPTH: 0 ==========================================\n000 0 | 2 8100 (0) 8000 (0)\n001 1 4000 | 1 4000 (0)\n002 1 2000 | 1 2000 (0)\n003 0 | 0\n004 0 | 0\n005 0 | 0\n006 0 | 0\n007 0 | 0\n========================================================================="
748+
expH := "\n=========================================================================\nMon Feb 27 12:10:28 UTC 2017 KΛÐΞMLIΛ hive: queen's address: 000000\npopulation: 2 (4), MinProxBinSize: 2, MinBinSize: 2, MaxBinSize: 4\n============ DEPTH: 0 ==========================================\n000 0 | 2 8100 (0) 8000 (0)\n001 1 4000 | 1 4000 (0)\n002 1 2000 | 1 2000 (0)\n003 0 | 0\n004 0 | 0\n005 0 | 0\n006 0 | 0\n007 0 | 0\n========================================================================="
749749
if expH[104:] != h[104:] {
750750
t.Fatalf("incorrect hive output. expected %v, got %v", expH, h)
751751
}

0 commit comments

Comments
 (0)