code: func (s *server) handleDonePeerMsg(state *peerState, sp *serverPeer) {
  	var list map[int32]*serverPeer
  	if sp.persistent {
  		list = state.persistentPeers
  	} else if sp.Inbound() {
  		list = state.inboundPeers
  	} else {
  		list = state.outboundPeers
  	}
  	if _, ok := list[sp.ID()]; ok {
  		if !sp.Inbound() && sp.VersionKnown() {
  			state.outboundGroups[addrmgr.GroupKey(sp.NA())]--
  		}
  		if !sp.Inbound() && sp.connReq != nil {
  			s.connManager.Disconnect(sp.connReq.ID())
  		}
  		delete(list, sp.ID())
  		srvrLog.Debugf("Removed peer %s", sp)
  		return
  	}
  
  	if sp.connReq != nil {
  		s.connManager.Disconnect(sp.connReq.ID())
  	}
  
  	// Update the address' last seen time if the peer has acknowledged
  	// our version and has sent us its version as well.
  	if sp.VerAckReceived() && sp.VersionKnown() && sp.NA() != nil {
  		s.addrManager.Connected(sp.NA())
  	}
  
  	// If we get here it means that either we didn't know about the peer
  	// or we purposefully deleted it.
  }
docs: // handleDonePeerMsg deals with peers that have signalled they are done.  It is
  // invoked from the peerHandler goroutine.