// Close stops watching for remote cluster configuration files to appear and
// will close all connections to remote clusters
433186
func (cm *ClusterMesh) Close() {
	cm.mutex.Lock()
	defer cm.mutex.Unlock()

	if cm.configWatcher != nil {
		cm.configWatcher.close()
	}

	for name, cluster := range cm.clusters {
		cluster.onRemove()
		delete(cm.clusters, name)
	}

	cm.controllers.RemoveAllAndWait()
}
797368
func (s *Store) Close(wait bool) error {
	s.closedMu.Lock()
	defer s.closedMu.Unlock()
	if s.closed {
		return nil
	}
	defer func() {
		s.closed = true
	}()

	close(s.done)
	s.wg.Wait()

	// XXX CLOSE OTHER CONNECTIONS
	if err := s.dbConn.Close(); err != nil {
		return err
	}
	s.dbConn = nil
	s.db = nil

	if s.raft != nil {
		f := s.raft.Shutdown()
		if wait {
			if e := f.(raft.Future); e.Error() != nil {
				return e.Error()
			}
		}
		s.raft = nil
	}

	if s.boltStore != nil {
		if err := s.boltStore.Close(); err != nil {
			return err
		}
		s.boltStore = nil
	}
	s.raftLog = nil
	s.raftStable = nil
	return nil
}
1087827
func (s *Server) Close(ctx context.Context) error {
	return s.Shutdown(ctx)
}
50914
func (c *connection) Close() error {
	c.streamLock.Lock()
	for _, s := range c.streams {
		// calling Reset instead of Close ensures that all streams are fully torn down
		s.Reset()
	}
	c.streams = make([]httpstream.Stream, 0)
	c.streamLock.Unlock()

	// now that all streams are fully torn down, it's safe to call close on the underlying connection,
	// which should be able to terminate immediately at this point, instead of waiting for any
	// remaining graceful stream termination.
	return c.conn.Close()
}
19588
func (remote *RemoteDebugger) Close() (err error) {
	remote.Lock()
	ws := remote.ws
	remote.ws = nil
	remote.Unlock()

	if ws != nil { // already closed
		close(remote.requests)
		close(remote.closed)
		err = ws.Close()
	}

	if remote.verbose {
		httpclient.StopLogging()
	}

	return
}
30886
func (s *Session) Close(optArgs ...CloseOpts) error {
	s.mu.Lock()
	defer s.mu.Unlock()

	if s.closed {
		return nil
	}

	if len(optArgs) >= 1 {
		if optArgs[0].NoReplyWait {
			s.mu.Unlock()
			s.NoReplyWait()
			s.mu.Lock()
		}
	}

	if s.cluster != nil {
		return s.cluster.Close()
	}
	s.cluster = nil
	s.closed = true

	return nil
}
600964
func (s *Snapshot) Close() error {
	if s == nil {
		return nil
	}

	if err := s.file.Close(); err != nil {
		return err
	}
	return os.Remove(s.file.Name())
}
425239
func (c *Conn) Close() error {
	fmt.Fprintf(c.Transcript, "Server closing connection\n")
	return c.Rwc.Close()
}
423150
func (s *remoteSite) Close() error {
	s.Lock()
	defer s.Unlock()

	s.cancel()
	for i := range s.connections {
		s.connections[i].Close()
	}
	s.connections = []*remoteConn{}
	return nil
}
710385
func (c *Socket) Close() error {
	err := c.l.Close()
	if c.rmdir {
		if rerr := os.RemoveAll(filepath.Dir(c.Path())); err == nil {
			err = rerr
		}
	}
	return err
}
1312792
func (f *Forwarder) Close() error {
	f.mu.Lock()
	defer f.mu.Unlock()
	return f.file.Close()
}
546770
func Close(c Closer) {
	if err := c.Close(); err != nil {
		log.Warnf("failed to close %v: %v", c, err)
	}
}
598067
func (rsync *RSync) Close() error {
	for _, f := range rsync.OnClose {
		if err := f.Close(); err != nil {
			return err
		}
	}
	return nil
}
958874
func (w *AgentConfigWatcher) Close() error {
	if w.plan != nil {
		w.plan.Stop()
	}
	return nil
}
565948
func (s *proxySocket) Close() {
	s.locker.Lock()

	select {
	case <-s.closing:
		s.locker.Unlock()
		return
	default:
	}

	close(s.closing)
	s.listener.Close()

	pairs := s.pairs
	s.pairs = nil

	s.locker.Unlock()

	// Immediately close all connection pairs for which cascading close was
	// requested in Accept.
	for _, pair := range pairs {
		pair.Rx.Close()
	}
}
1231449
func (rs *RetryingSink) Close() error {
	rs.once.Do(func() {
		close(rs.closed)
	})

	return nil
}
67506
func (t *TaskWatcher) Close() error {
	for _, x := range t.taskIDs {
		t.parent.rm(x, t)
	}
	return nil
}