mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
swarm/network: rename depth to radius
This commit is contained in:
parent
a8ce97e64b
commit
408fe36832
1 changed files with 5 additions and 5 deletions
|
|
@ -175,12 +175,12 @@ func (k *Kademlia) SuggestPeer() (a *BzzAddr, o int, want bool) {
|
||||||
k.lock.Lock()
|
k.lock.Lock()
|
||||||
defer k.lock.Unlock()
|
defer k.lock.Unlock()
|
||||||
minsize := k.MinBinSize
|
minsize := k.MinBinSize
|
||||||
depth := neighbourhoodRadiusForPot(k.conns, k.NeighbourhoodSize, k.base)
|
radius := neighbourhoodRadiusForPot(k.conns, k.NeighbourhoodSize, k.base)
|
||||||
// if there is a callable neighbour within the current proxBin, connect
|
// if there is a callable neighbour within the current proxBin, connect
|
||||||
// this makes sure nearest neighbour set is fully connected
|
// this makes sure nearest neighbour set is fully connected
|
||||||
var ppo int
|
var ppo int
|
||||||
k.addrs.EachNeighbour(k.base, Pof, func(val pot.Val, po int) bool {
|
k.addrs.EachNeighbour(k.base, Pof, func(val pot.Val, po int) bool {
|
||||||
if po < depth {
|
if po < radius {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
e := val.(*entry)
|
e := val.(*entry)
|
||||||
|
|
@ -208,7 +208,7 @@ func (k *Kademlia) SuggestPeer() (a *BzzAddr, o int, want bool) {
|
||||||
bpo = append(bpo, po)
|
bpo = append(bpo, po)
|
||||||
minsize = size
|
minsize = size
|
||||||
}
|
}
|
||||||
return size > 0 && po < depth
|
return size > 0 && po < radius
|
||||||
})
|
})
|
||||||
// all buckets are full, ie., minsize == k.MinBinSize
|
// all buckets are full, ie., minsize == k.MinBinSize
|
||||||
if len(bpo) == 0 {
|
if len(bpo) == 0 {
|
||||||
|
|
@ -221,7 +221,7 @@ func (k *Kademlia) SuggestPeer() (a *BzzAddr, o int, want bool) {
|
||||||
nxt := bpo[0]
|
nxt := bpo[0]
|
||||||
k.addrs.EachBin(k.base, Pof, nxt, func(po, _ int, f func(func(pot.Val) bool) bool) bool {
|
k.addrs.EachBin(k.base, Pof, nxt, func(po, _ int, f func(func(pot.Val) bool) bool) bool {
|
||||||
// for each bin (up until depth) we find callable candidate peers
|
// for each bin (up until depth) we find callable candidate peers
|
||||||
if po >= depth {
|
if po >= radius {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return f(func(val pot.Val) bool {
|
return f(func(val pot.Val) bool {
|
||||||
|
|
@ -751,7 +751,7 @@ type Health struct {
|
||||||
func (k *Kademlia) Healthy(pp *PeerPot) *Health {
|
func (k *Kademlia) Healthy(pp *PeerPot) *Health {
|
||||||
k.lock.RLock()
|
k.lock.RLock()
|
||||||
defer k.lock.RUnlock()
|
defer k.lock.RUnlock()
|
||||||
if len(pp.NNSet) < k.MinProxBinSize {
|
if len(pp.NNSet) < k.NeighbourhoodSize {
|
||||||
panic("wrong peerpot")
|
panic("wrong peerpot")
|
||||||
}
|
}
|
||||||
gotnn, countgotnn, culpritsgotnn := k.connectedNeighbours(pp.NNSet)
|
gotnn, countgotnn, culpritsgotnn := k.connectedNeighbours(pp.NNSet)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue