mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: fixed clientPool.setLimits
This commit is contained in:
parent
0cbf1d89af
commit
a094623a10
1 changed files with 8 additions and 6 deletions
|
|
@ -366,12 +366,14 @@ func (f *clientPool) setLimits(count int, totalCap uint64) {
|
||||||
|
|
||||||
f.countLimit = count
|
f.countLimit = count
|
||||||
f.capacityLimit = totalCap
|
f.capacityLimit = totalCap
|
||||||
now := mclock.Now()
|
if f.connectedCapacity > f.capacityLimit || f.connectedQueue.Size() > f.countLimit {
|
||||||
f.connectedQueue.MultiPop(func(data interface{}, priority int64) bool {
|
now := mclock.Now()
|
||||||
c := data.(*clientInfo)
|
f.connectedQueue.MultiPop(func(data interface{}, priority int64) bool {
|
||||||
f.dropClient(c, now, true)
|
c := data.(*clientInfo)
|
||||||
return f.connectedCapacity > f.capacityLimit || f.connectedQueue.Size() > f.countLimit
|
f.dropClient(c, now, true)
|
||||||
})
|
return f.connectedCapacity > f.capacityLimit || f.connectedQueue.Size() > f.countLimit
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// requestCost feeds request cost after serving a request from the given peer.
|
// requestCost feeds request cost after serving a request from the given peer.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue