mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: fixed minBufLimit limitation
This commit is contained in:
parent
70ddf60b16
commit
120ef63174
1 changed files with 8 additions and 6 deletions
|
|
@ -184,12 +184,14 @@ func (ct *costTracker) makeCostList(globalFactor float64) RequestCostList {
|
||||||
for code, data := range reqAvgTimeCost {
|
for code, data := range reqAvgTimeCost {
|
||||||
baseCost := maxCost(data.baseCost, reqMaxInSize[code].baseCost, reqMaxOutSize[code].baseCost)
|
baseCost := maxCost(data.baseCost, reqMaxInSize[code].baseCost, reqMaxOutSize[code].baseCost)
|
||||||
reqCost := maxCost(data.reqCost, reqMaxInSize[code].reqCost, reqMaxOutSize[code].reqCost)
|
reqCost := maxCost(data.reqCost, reqMaxInSize[code].reqCost, reqMaxOutSize[code].reqCost)
|
||||||
// always enforce maximum request cost <= minimum buffer limit
|
if ct.minBufLimit != 0 {
|
||||||
maxCost := baseCost + reqCost*minBufferReqAmount[code]
|
// if minBufLimit is set then always enforce maximum request cost <= minBufLimit
|
||||||
if maxCost > ct.minBufLimit {
|
maxCost := baseCost + reqCost*minBufferReqAmount[code]
|
||||||
mul := 0.999 * float64(ct.minBufLimit) / float64(maxCost)
|
if maxCost > ct.minBufLimit {
|
||||||
baseCost = uint64(float64(baseCost) * mul)
|
mul := 0.999 * float64(ct.minBufLimit) / float64(maxCost)
|
||||||
reqCost = uint64(float64(reqCost) * mul)
|
baseCost = uint64(float64(baseCost) * mul)
|
||||||
|
reqCost = uint64(float64(reqCost) * mul)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list = append(list, requestCostListItem{
|
list = append(list, requestCostListItem{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue