code: func NewClientManager(curve PieceWiseLinear, clock mclock.Clock) *ClientManager {
  	cm := &ClientManager{
  		clock:         clock,
  		rcQueue:       prque.New(func(a interface{}, i int) { a.(*ClientNode).queueIndex = i }),
  		capLastUpdate: clock.Now(),
  	}
  	if curve != nil {
  		cm.SetRechargeCurve(curve)
  	}
  	return cm
  }
docs: // NewClientManager returns a new client manager.
  // Client manager enhances flow control performance by allowing client buffers
  // to recharge quicker than the minimum guaranteed recharge rate if possible.
  // The sum of all minimum recharge rates (sumRecharge) is updated each time
  // a clients starts or finishes buffer recharging. Then an adjusted total
  // recharge rate is calculated using a piecewise linear recharge curve:
  //
  // totalRecharge = curve(sumRecharge)
  // (totalRecharge >= sumRecharge is enforced)
  //
  // Then the "bonus" buffer recharge is distributed between currently recharging
  // clients proportionally to their minimum recharge rates.
  //
  // Note: total recharge is proportional to the average number of parallel running
  // serving threads. A recharge value of 1000000 corresponds to one thread in average.
  // The maximum number of allowed serving threads should always be considerably
  // higher than the targeted average number.
  //
  // Note 2: although it is possible to specify a curve allowing the total target
  // recharge starting from zero sumRecharge, it makes sense to add a linear ramp
  // starting from zero in order to not let a single low-priority client use up
  // the entire server capacity and thus ensure quick availability for others at
  // any moment.