code: func (sm *SyncManager) handleDonePeerMsg(peer *peerpkg.Peer) {
  	state, exists := sm.peerStates[peer]
  	if !exists {
  		log.Warnf("Received done peer message for unknown peer %s", peer)
  		return
  	}
  
  	// Remove the peer from the list of candidate peers.
  	delete(sm.peerStates, peer)
  
  	log.Infof("Lost peer %s", peer)
  
  	sm.clearRequestedState(state)
  
  	if peer == sm.syncPeer {
  		// Update the sync peer. The server has already disconnected the
  		// peer before signaling to the sync manager.
  		sm.updateSyncPeer(false)
  	}
  }
docs: // handleDonePeerMsg deals with peers that have signalled they are done.  It
  // removes the peer as a candidate for syncing and in the case where it was
  // the current sync peer, attempts to select a new best peer to sync from.  It
  // is invoked from the syncHandler goroutine.