code: func (p *peerConnection) setIdle(started time.Time, delivered int, throughput *float64, idle *int32) {
  	// Irrelevant of the scaling, make sure the peer ends up idle
  	defer atomic.StoreInt32(idle, 0)
  
  	p.lock.Lock()
  	defer p.lock.Unlock()
  
  	// If nothing was delivered (hard timeout / unavailable data), reduce throughput to minimum
  	if delivered == 0 {
  		*throughput = 0
  		return
  	}
  	// Otherwise update the throughput with a new measurement
  	elapsed := time.Since(started) + 1 // +1 (ns) to ensure non-zero divisor
  	measured := float64(delivered) / (float64(elapsed) / float64(time.Second))
  
  	*throughput = (1-measurementImpact)*(*throughput) + measurementImpact*measured
  	p.rtt = time.Duration((1-measurementImpact)*float64(p.rtt) + measurementImpact*float64(elapsed))
  
  	p.log.Trace("Peer throughput measurements updated",
  		"hps", p.headerThroughput, "bps", p.blockThroughput,
  		"rps", p.receiptThroughput, "sps", p.stateThroughput,
  		"miss", len(p.lacking), "rtt", p.rtt)
  }
docs: // setIdle sets the peer to idle, allowing it to execute new retrieval requests.
  // Its estimated retrieval throughput is updated with that measured just now.