mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge 762185b145 into f55c26ae6d
This commit is contained in:
commit
6ccbabe640
1 changed files with 6 additions and 6 deletions
|
|
@ -174,18 +174,18 @@ func (sp selectPeerItem) Weight() int64 {
|
||||||
// nextRequest returns the next possible request from any peer, along with the
|
// nextRequest returns the next possible request from any peer, along with the
|
||||||
// associated peer and necessary waiting time
|
// associated peer and necessary waiting time
|
||||||
func (d *requestDistributor) nextRequest() (distPeer, *distReq, time.Duration) {
|
func (d *requestDistributor) nextRequest() (distPeer, *distReq, time.Duration) {
|
||||||
checkedPeers := make(map[distPeer]struct{})
|
|
||||||
elem := d.reqQueue.Front()
|
|
||||||
var (
|
var (
|
||||||
bestPeer distPeer
|
bestPeer distPeer
|
||||||
bestReq *distReq
|
bestReq *distReq
|
||||||
bestWait time.Duration
|
bestWait time.Duration
|
||||||
sel *weightedRandomSelect
|
sel *weightedRandomSelect
|
||||||
|
checkedPeers = make(map[distPeer]struct{})
|
||||||
)
|
)
|
||||||
|
|
||||||
d.peerLock.RLock()
|
d.peerLock.RLock()
|
||||||
defer d.peerLock.RUnlock()
|
defer d.peerLock.RUnlock()
|
||||||
|
|
||||||
|
elem := d.reqQueue.Front()
|
||||||
for (len(d.peers) > 0 || elem == d.reqQueue.Front()) && elem != nil {
|
for (len(d.peers) > 0 || elem == d.reqQueue.Front()) && elem != nil {
|
||||||
req := elem.Value.(*distReq)
|
req := elem.Value.(*distReq)
|
||||||
canSend := false
|
canSend := false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue