code: func (v *priorityClientPool) setLimits(count int, totalCap uint64) {
  	v.lock.Lock()
  	defer v.lock.Unlock()
  
  	v.totalCapAnnounced = totalCap
  	if totalCap > v.totalCap {
  		v.setLimitsNow(count, totalCap)
  		v.subs.send(totalCap, false)
  		return
  	}
  	v.setLimitsNow(count, v.totalCap)
  	if totalCap < v.totalCap {
  		v.subs.send(totalCap, totalCap < v.totalConnectedCap)
  		for i, s := range v.updateSchedule {
  			if totalCap >= s.totalCap {
  				s.totalCap = totalCap
  				v.updateSchedule = v.updateSchedule[:i+1]
  				return
  			}
  		}
  		v.updateSchedule = append(v.updateSchedule, scheduledUpdate{time: mclock.Now() + mclock.AbsTime(dropCapacityDelay), totalCap: totalCap})
  		if len(v.updateSchedule) == 1 {
  			v.scheduleCounter++
  			id := v.scheduleCounter
  			v.updateSchedule[0].id = id
  			time.AfterFunc(dropCapacityDelay, func() { v.checkUpdate(id) })
  		}
  	} else {
  		v.updateSchedule = nil
  	}
  }
docs: // setLimits updates the allowed peer count and total capacity of the priority
  // client pool. Since the free client pool is a child of the priority pool the
  // remaining peer count and capacity is assigned to the free pool by calling its
  // own setLimits function.
  //
  // Note: a decreasing change of the total capacity is applied with a delay.