// Close closes the Publisher and removes all connections
191731
func (f *Pub) Close() error {
	f.wo.Lock()
	ok := f.closed
	f.wo.Unlock()

	if ok {
		return nil
	}

	f.wg.Wait()

	f.wo.Lock()
	f.closed = true
	f.wo.Unlock()

	f.branches.Close()

	f.roots.Do(func(rm SenderDetachCloser) {
		go rm.Detach(f)
	})

	f.roots.Close()
	f.enders.Close()

	close(f.csignal)
	return nil
}
214212
func (s *SNMP) Close() {
	if s.conn != nil {
		s.conn.Close()
		s.conn = nil
		s.engine = nil
	}
}
1081211
func Close(connectionId uint64) {
	mutex.Lock()
	delete(connections, connectionId)
	mutex.Unlock()
}
879365
func (c SyncConn) Close() error {
	return errors.CombineErrs("error closing SyncConn", errors.NetworkError,
		c.SyncScanner.Close(), c.SyncSender.Close())
}
767349
func (r *FilteredConn) Close() error {
	select {
	case <-r.closed:
		return errClosed
	default:
	}
	close(r.closed)
	r.source.removeConn(r)
	return nil
}
82913
func (c *Client) Close() error {
	if c.conn != nil {
		return c.conn.Close()
	}
	return nil
}
1001329
func (c *mongoDBConnectionProducer) Close() error {
	c.Lock()
	defer c.Unlock()

	if c.session != nil {
		c.session.Close()
	}

	c.session = nil

	return nil
}
334695
func (r *Receiver) Close() error {
	r.cl.Lock()
	defer r.cl.Unlock()
	if r.cl.client == nil {
		return ErrNotConnected
	}
	close(r.chanClose)
	return r.cl.Close()
}
983362
func (c *SQLConnectionProducer) Close() error {
	// Grab the write lock
	c.Lock()
	defer c.Unlock()

	if c.db != nil {
		c.db.Close()
	}

	c.db = nil

	return nil
}
462148
func (client Client) Close() error {
	err := client.Sender.Close()
	return errors.Trace(err)
}
557316
func (br *BlockReader) Close() error {
	br.closed = true
	if br.conn != nil {
		br.conn.Close()
	}

	return nil
}
792770
func (w *Writer) Close() error {
	conn := w.getConn()
	if conn != nil {
		err := conn.close()
		w.setConn(nil)
		return err
	}
	return nil
}
612356
func (s session) Close() error {
	if s.Connection == nil {
		return nil
	}
	return s.Connection.Close()
}
1127117
func (cl *Client) Close() {
	cl.lock()
	defer cl.unlock()
	cl.closed.Set()
	cl.eachDhtServer(func(s *dht.Server) { s.Close() })
	cl.closeSockets()
	for _, t := range cl.torrents {
		t.close()
	}
	for _, f := range cl.onClose {
		f()
	}
	cl.event.Broadcast()
}
104035
func (dc *DefaultConnector) Close() <-chan bool {
	closed := make(chan bool)
	go func() {
		dc.bootstrapBrokers = nil
		closed <- true
	}()

	return closed
}
464078
func (c *Conn) Close(success bool) error {
	if c.isLocal {
		return nil
	}

	if success {
		c.remotes.ObserveIfExists(c.peer, remotes.DefaultObservationWeight)
	} else {
		c.remotes.ObserveIfExists(c.peer, -remotes.DefaultObservationWeight)
	}

	return c.ClientConn.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
}