mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
les:flowcontrol: fix division by zero for lightserv flag
This commit is contained in:
parent
525116dbff
commit
43064d8ddd
1 changed files with 5 additions and 1 deletions
|
|
@ -81,10 +81,14 @@ func NewClientManager(rcTarget, maxSimReq, maxRcSum uint64) *ClientManager {
|
||||||
cm := &ClientManager{
|
cm := &ClientManager{
|
||||||
nodes: make(map[*cmNode]struct{}),
|
nodes: make(map[*cmNode]struct{}),
|
||||||
resumeQueue: make(chan chan bool),
|
resumeQueue: make(chan chan bool),
|
||||||
rcRecharge: rcConst * rcConst / (100*rcConst/rcTarget - rcConst),
|
rcRecharge: rcConst * rcConst,
|
||||||
maxSimReq: maxSimReq,
|
maxSimReq: maxSimReq,
|
||||||
maxRcSum: maxRcSum,
|
maxRcSum: maxRcSum,
|
||||||
}
|
}
|
||||||
|
if rcTarget < 100 {
|
||||||
|
cm.rcRecharge /= (100*rcConst/rcTarget - rcConst)
|
||||||
|
}
|
||||||
|
|
||||||
go cm.queueProc()
|
go cm.queueProc()
|
||||||
return cm
|
return cm
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue