code: func (s *Serf) Shutdown() error {
  	s.stateLock.Lock()
  	defer s.stateLock.Unlock()
  
  	if s.state == SerfShutdown {
  		return nil
  	}
  
  	if s.state != SerfLeft {
  		s.logger.Printf("[WARN] serf: Shutdown without a Leave")
  	}
  
  	// Wait to close the shutdown channel until after we've shut down the
  	// memberlist and its associated network resources, since the shutdown
  	// channel signals that we are cleaned up outside of Serf.
  	s.state = SerfShutdown
  	err := s.memberlist.Shutdown()
  	if err != nil {
  		return err
  	}
  	close(s.shutdownCh)
  
  	// Wait for the snapshoter to finish if we have one
  	if s.snapshotter != nil {
  		s.snapshotter.Wait()
  	}
  
  	return nil
  }
docs: // Shutdown forcefully shuts down the Serf instance, stopping all network
  // activity and background maintenance associated with the instance.
  //
  // This is not a graceful shutdown, and should be preceded by a call
  // to Leave. Otherwise, other nodes in the cluster will detect this node's
  // exit as a node failure.
  //
  // It is safe to call this method multiple times.