mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: added warning for reduced capacity
This commit is contained in:
parent
070c4c2186
commit
59baa07849
1 changed files with 6 additions and 0 deletions
|
|
@ -202,6 +202,7 @@ func (s *LesServer) startEventLoop() {
|
|||
totalCapacity := s.fcManager.SubscribeTotalCapacity(totalCapacityCh)
|
||||
s.priorityClientPool.setLimits(s.maxPeers, totalCapacity)
|
||||
|
||||
var maxFreePeers uint64
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
|
|
@ -211,6 +212,11 @@ func (s *LesServer) startEventLoop() {
|
|||
updateRecharge()
|
||||
case totalCapacity = <-totalCapacityCh:
|
||||
s.logTotalCap.Update(float64(totalCapacity))
|
||||
newFreePeers := totalCapacity / s.freeClientCap
|
||||
if newFreePeers < maxFreePeers && newFreePeers < uint64(s.maxPeers) {
|
||||
log.Warn("Reduced total capacity", "maxFreePeers", newFreePeers)
|
||||
}
|
||||
maxFreePeers = newFreePeers
|
||||
s.priorityClientPool.setLimits(s.maxPeers, totalCapacity)
|
||||
case <-s.protocolManager.quitSync:
|
||||
s.protocolManager.wg.Done()
|
||||
|
|
|
|||
Loading…
Reference in a new issue