code: func (ps *peerSet) medianRTT() time.Duration {
  	// Gather all the currently measured round trip times
  	ps.lock.RLock()
  	defer ps.lock.RUnlock()
  
  	rtts := make([]float64, 0, len(ps.peers))
  	for _, p := range ps.peers {
  		p.lock.RLock()
  		rtts = append(rtts, float64(p.rtt))
  		p.lock.RUnlock()
  	}
  	sort.Float64s(rtts)
  
  	median := rttMaxEstimate
  	if qosTuningPeers <= len(rtts) {
  		median = time.Duration(rtts[qosTuningPeers/2]) // Median of our tuning peers
  	} else if len(rtts) > 0 {
  		median = time.Duration(rtts[len(rtts)/2]) // Median of our connected peers (maintain even like this some baseline qos)
  	}
  	// Restrict the RTT into some QoS defaults, irrelevant of true RTT
  	if median < rttMinEstimate {
  		median = rttMinEstimate
  	}
  	if median > rttMaxEstimate {
  		median = rttMaxEstimate
  	}
  	return median
  }
docs: // medianRTT returns the median RTT of the peerset, considering only the tuning
  // peers if there are more peers available.