aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-05-11 22:06:42 +0800
committerobscuren <geffobscura@gmail.com>2015-05-11 23:21:22 +0800
commit064cf1609987bb0f6c59c1e790b7811d9a783fef (patch)
tree6897a45d6ea0630afa6b5c1ede441c994262a478 /eth/downloader
parentd37a2559b928a8118a5eec77e2181cb6cf566be1 (diff)
downloadgo-tangerine-064cf1609987bb0f6c59c1e790b7811d9a783fef.tar.gz
go-tangerine-064cf1609987bb0f6c59c1e790b7811d9a783fef.tar.zst
go-tangerine-064cf1609987bb0f6c59c1e790b7811d9a783fef.zip
eth/downloader: use count instead of peers, clearer
Diffstat (limited to 'eth/downloader')
-rw-r--r--eth/downloader/downloader.go4
-rw-r--r--eth/downloader/peer.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index 5e9931f59..4c7ebe646 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -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 {
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go
index 1ff2d5149..4abae8d5e 100644
--- a/eth/downloader/peer.go
+++ b/eth/downloader/peer.go
@@ -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()