code: func (v *priorityClientPool) registerPeer(p *peer) {
  	v.lock.Lock()
  	defer v.lock.Unlock()
  
  	id := p.ID()
  	c := v.clients[id]
  	if c.connected {
  		return
  	}
  	if c.cap == 0 && v.child != nil {
  		v.child.registerPeer(p)
  	}
  	if c.cap != 0 && v.totalConnectedCap+c.cap > v.totalCap {
  		go v.ps.Unregister(p.id)
  		return
  	}
  
  	c.connected = true
  	c.peer = p
  	v.clients[id] = c
  	if c.cap != 0 {
  		v.priorityCount++
  		v.totalConnectedCap += c.cap
  		if v.child != nil {
  			v.child.setLimits(v.maxPeers-v.priorityCount, v.totalCap-v.totalConnectedCap)
  		}
  		p.updateCapacity(c.cap)
  	}
  }
docs: // registerPeer is called when a new client is connected. If the client has no
  // priority assigned then it is passed to the child pool which may either keep it
  // or disconnect it.
  //
  // Note: priorityClientPool also stores a record about free clients while they are
  // connected in order to be able to assign priority to them later.