forked from cerc-io/plugeth
eth/downloader: use count instead of peers, clearer
This commit is contained in:
parent
ebbd8b0743
commit
fa53c5e074
@ -363,7 +363,7 @@ out:
|
||||
}
|
||||
}
|
||||
// After removing bad peers make sure we actually have sufficient peer left to keep downloading
|
||||
if d.peers.Peers() == 0 {
|
||||
if d.peers.Len() == 0 {
|
||||
d.queue.Reset()
|
||||
return errNoPeers
|
||||
}
|
||||
@ -400,7 +400,7 @@ out:
|
||||
if d.queue.InFlight() == 0 {
|
||||
d.queue.Reset()
|
||||
|
||||
return fmt.Errorf("%v peers available = %d. total peers = %d. hashes needed = %d", errPeersUnavailable, len(idlePeers), d.peers.Peers(), d.queue.Pending())
|
||||
return fmt.Errorf("%v peers available = %d. total peers = %d. hashes needed = %d", errPeersUnavailable, len(idlePeers), d.peers.Len(), d.queue.Pending())
|
||||
}
|
||||
|
||||
} else if d.queue.InFlight() == 0 {
|
||||
|
@ -154,8 +154,8 @@ func (ps *peerSet) Peer(id string) *peer {
|
||||
return ps.peers[id]
|
||||
}
|
||||
|
||||
// Peers returns if the current number of peers in the set.
|
||||
func (ps *peerSet) Peers() int {
|
||||
// Len returns if the current number of peers in the set.
|
||||
func (ps *peerSet) Len() int {
|
||||
ps.lock.RLock()
|
||||
defer ps.lock.RUnlock()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user