code: func (c *meteredConn) Close() error {
  	err := c.Conn.Close()
  	c.lock.RLock()
  	if c.id == (enode.ID{}) {
  		// If the peer disconnects before the handshake.
  		c.lock.RUnlock()
  		meteredPeerFeed.Send(MeteredPeerEvent{
  			Type:    PeerHandshakeFailed,
  			IP:      c.ip,
  			Elapsed: time.Since(c.connected),
  		})
  		return err
  	}
  	id := c.id
  	if !c.trafficMetered {
  		// If the peer isn't registered in the traffic registries.
  		c.lock.RUnlock()
  		meteredPeerFeed.Send(MeteredPeerEvent{
  			Type: PeerDisconnected,
  			IP:   c.ip,
  			ID:   id,
  		})
  		return err
  	}
  	ingress, egress := uint64(c.ingressMeter.Count()), uint64(c.egressMeter.Count())
  	c.lock.RUnlock()
  
  	// Decrement the metered peer count
  	atomic.AddInt32(&meteredPeerCount, -1)
  
  	// Unregister the peer from the traffic registries
  	key := fmt.Sprintf("%s/%s", c.ip, id)
  	PeerIngressRegistry.Unregister(key)
  	PeerEgressRegistry.Unregister(key)
  
  	meteredPeerFeed.Send(MeteredPeerEvent{
  		Type:    PeerDisconnected,
  		IP:      c.ip,
  		ID:      id,
  		Ingress: ingress,
  		Egress:  egress,
  	})
  	return err
  }
docs: // Close delegates a close operation to the underlying connection, unregisters
  // the peer from the traffic registries and emits close event.