swarm/network: minor comment, discovery test default arg

This commit is contained in:
zelig 2019-01-16 09:45:41 +01:00
parent 94cd49d17d
commit 80eca895a2
2 changed files with 4 additions and 3 deletions

View file

@ -173,8 +173,9 @@ func (k *Kademlia) SuggestPeer() (suggestedPeer *BzzAddr, saturationDepth int, c
k.lock.Lock() k.lock.Lock()
defer k.lock.Unlock() defer k.lock.Unlock()
radius := neighbourhoodRadiusForPot(k.conns, k.NeighbourhoodSize, k.base) radius := neighbourhoodRadiusForPot(k.conns, k.NeighbourhoodSize, k.base)
// first collect undersaturated bins starting from smallest size from shallow to deep // collect undersaturated bins in ascending order of number of connected peers
// saturation is a map: bin size (int) -> deepening list of PO bins with that size ([]int) // and from shallow to deep (ascending order of PO)
// insert them in a map of bin arrays, keyed with the number of connected peers
saturation := make(map[int][]int) saturation := make(map[int][]int)
var lastPO int // the last non-empty PO bin in the iteration var lastPO int // the last non-empty PO bin in the iteration
saturationDepth = -1 // the deepest PO such that all shallower bins have >= k.MinBinSize peers saturationDepth = -1 // the deepest PO such that all shallower bins have >= k.MinBinSize peers

View file

@ -82,7 +82,7 @@ func getDbStore(nodeID string) (*state.DBStore, error) {
} }
var ( var (
nodeCount = flag.Int("nodes", 10, "number of nodes to create (default 10)") nodeCount = flag.Int("nodes", 32, "number of nodes to create (default 32)")
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)") initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
loglevel = flag.Int("loglevel", 3, "verbosity of logs") loglevel = flag.Int("loglevel", 3, "verbosity of logs")
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs") rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")