code: func (d *Downloader) qosTuner() {
  	for {
  		// Retrieve the current median RTT and integrate into the previoust target RTT
  		rtt := time.Duration((1-qosTuningImpact)*float64(atomic.LoadUint64(&d.rttEstimate)) + qosTuningImpact*float64(d.peers.medianRTT()))
  		atomic.StoreUint64(&d.rttEstimate, uint64(rtt))
  
  		// A new RTT cycle passed, increase our confidence in the estimated RTT
  		conf := atomic.LoadUint64(&d.rttConfidence)
  		conf = conf + (1000000-conf)/2
  		atomic.StoreUint64(&d.rttConfidence, conf)
  
  		// Log the new QoS values and sleep until the next RTT
  		log.Debug("Recalculated downloader QoS values", "rtt", rtt, "confidence", float64(conf)/1000000.0, "ttl", d.requestTTL())
  		select {
  		case <-d.quitCh:
  			return
  		case <-time.After(rtt):
  		}
  	}
  }
docs: // qosTuner is the quality of service tuning loop that occasionally gathers the
  // peer latency statistics and updates the estimated request round trip time.