code: func (s *LesServer) startEventLoop() {
  	s.protocolManager.wg.Add(1)
  
  	var processing bool
  	blockProcFeed := make(chan bool, 100)
  	s.protocolManager.blockchain.(*core.BlockChain).SubscribeBlockProcessingEvent(blockProcFeed)
  	totalRechargeCh := make(chan uint64, 100)
  	totalRecharge := s.costTracker.subscribeTotalRecharge(totalRechargeCh)
  	totalCapacityCh := make(chan uint64, 100)
  	updateRecharge := func() {
  		if processing {
  			s.protocolManager.servingQueue.setThreads(s.thcBlockProcessing)
  			s.fcManager.SetRechargeCurve(flowcontrol.PieceWiseLinear{{0, 0}, {totalRecharge, totalRecharge}})
  		} else {
  			s.protocolManager.servingQueue.setThreads(s.thcNormal)
  			s.fcManager.SetRechargeCurve(flowcontrol.PieceWiseLinear{{0, 0}, {totalRecharge / 10, totalRecharge}, {totalRecharge, totalRecharge}})
  		}
  	}
  	updateRecharge()
  	totalCapacity := s.fcManager.SubscribeTotalCapacity(totalCapacityCh)
  	s.priorityClientPool.setLimits(s.maxPeers, totalCapacity)
  
  	go func() {
  		for {
  			select {
  			case processing = <-blockProcFeed:
  				updateRecharge()
  			case totalRecharge = <-totalRechargeCh:
  				updateRecharge()
  			case totalCapacity = <-totalCapacityCh:
  				s.priorityClientPool.setLimits(s.maxPeers, totalCapacity)
  			case <-s.protocolManager.quitSync:
  				s.protocolManager.wg.Done()
  				return
  			}
  		}
  	}()
  }
docs: // startEventLoop starts an event handler loop that updates the recharge curve of
  // the client manager and adjusts the client pool's size according to the total
  // capacity updates coming from the client manager