// Close shuts down underlying connections.
// This function hides the inner implementation.
14847
func (dg *discoveryGateway) Close(ctx context.Context) error {
	dg.buffer.Shutdown()
	for _, ctw := range dg.tabletsWatchers {
		ctw.Stop()
	}
	return nil
}
266231
func (client *Client) Close() (err error) {
	client.Lock()
	defer client.Unlock()
	if client.conn != nil {
		err = client.conn.Close()
		client.conn = nil
	}
	return
}
809436
func (c *clientConn) Close() error {
	defer c.wg.Wait()
	return c.conn.Close()
}
359873
func (s *session) close() error {
	s.closeOnce.Do(func() {
		s.cancel()
		if s.conn != nil {
			s.conn.Close(false)
		}
		close(s.closed)
	})

	return nil
}
175162
func (p *conn) Close() error {
	p.Lock()
	defer p.Unlock()
	if p.IsOpen() {
		p.open = false
		return p.c.Close()
	}
	return nil
}
165992
func (c *Client) Close() error {
	if err := c.Flush(); err != nil {
		return err
	}
	c.buf = nil
	return c.conn.Close()
}
855614
func (c *Conn) Close() error {
	if c == nil {
		return nil
	}
	c.Closed = true
	if c.Conn != nil {
		return c.Conn.Close()
	}
	return nil
}
578688
func (conn *ProtectedConn) Close() (err error) {
	conn.mutex.Lock()
	defer conn.mutex.Unlock()

	if !conn.isClosed {
		conn.isClosed = true
		if conn.Conn == nil {
			if conn.socketFd == socketError {
				err = nil
			} else {
				err = syscall.Close(conn.socketFd)
				// update socket fd to socketError
				// to make it explicit this connection
				// has been closed
				conn.socketFd = socketError
			}
		} else {
			err = conn.Conn.Close()
		}
	}
	return err
}
777421
func (s *Server) Close() error {
	s.listenerMutex.Lock()
	defer s.listenerMutex.Unlock()
	s.closed = true
	if s.listener != nil {
		err := s.listener.Close()
		s.listener = nil
		return err
	}
	return nil
}
1308677
func (c *Conn) Close() error {
	c.wio.Lock()
	defer c.wio.Unlock()
	c.rio.Lock()
	defer c.rio.Unlock()
	return c.dev.Close()
}
328046
func (c *Client) Close() {
	for _, cns := range c.freeconn {
		for _, cn := range cns {
			c.cleanupFreeConn(cn.nc)
		}
	}
}
658060
func (c *Conn) Close() error {
	c.initClosing()

	c.closingmu.Lock()
	defer c.closingmu.Unlock()

	// short-circuit with an error if we are already closed
	select {
	case <-c.closing:
		return &net.OpError{
			Op:   "close",
			Net:  network,
			Addr: c.LocalAddr(),
			Err:  neterr{timeout: false, err: connClosed},
		}
	default:
		close(c.closing)
	}

	return nil
}
471387
func (s *server) Close() error {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	if s.closed {
		return nil
	}
	return s.closeWithMutex()
}
1138229
func (c *Conn) Close() error {
	if c.CloseMock == nil {
		return nil
	}

	return c.CloseMock()
}
1112071
func (c *SocketConnection) Close() error {
	if err := c.Conn.Close(); err != nil {
		return err
	}

	return nil
}
128414
func (conn *UDPConn) Close() error {
	close(conn.closeChan)
	return conn.udpConn.Close()
}
1246416
func (c *Connection) Close() error {
	c.lock.Lock()
	defer c.lock.Unlock()

	if c.client != nil {
		err := c.client.Close()
		for waiterID := range c.closeWaiters {
			close(c.closeWaiters[waiterID])
		}
		c.client = nil
		return err
	}
	return nil
}