les: fixed clientPool.setLimits

This commit is contained in:
Zsolt Felfoldi 2019-09-14 03:28:59 +02:00
parent 0cbf1d89af
commit a094623a10

View file

@ -366,6 +366,7 @@ func (f *clientPool) setLimits(count int, totalCap uint64) {
f.countLimit = count
f.capacityLimit = totalCap
if f.connectedCapacity > f.capacityLimit || f.connectedQueue.Size() > f.countLimit {
now := mclock.Now()
f.connectedQueue.MultiPop(func(data interface{}, priority int64) bool {
c := data.(*clientInfo)
@ -373,6 +374,7 @@ func (f *clientPool) setLimits(count int, totalCap uint64) {
return f.connectedCapacity > f.capacityLimit || f.connectedQueue.Size() > f.countLimit
})
}
}
// requestCost feeds request cost after serving a request from the given peer.
func (f *clientPool) requestCost(p *peer, cost uint64) {