// Close disconnects the connection by sending hci disconnect command to the device.
434314
func (c *Conn) Close() error {
	select {
	case <-c.chDone:
		// Return if it's already closed.
		return nil
	default:
		c.hci.Send(&cmd.Disconnect{
			ConnectionHandle: c.param.ConnectionHandle(),
			Reason:           0x13,
		}, nil)
		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()
}
560487
func (c *ZkConn) Close() error {
	c.mu.Lock()
	defer c.mu.Unlock()
	if c.conn != nil {
		c.conn.Close()
	}
	return nil
}
1115946
func (c *SSHClient) Close() error {
	if c.sessOpened {
		c.sess.Close()
		c.sessOpened = false
	}
	if !c.connOpened {
		return fmt.Errorf("Trying to close the already closed connection")
	}

	err := c.conn.Close()
	c.connOpened = false
	c.running = false

	return err
}
1110190
func (conn *Conn) Close() error {
	// Guard against double-call of Close() if we get an error in send()
	// as calling sock.Close() will cause recv() to receive EOF in readstring()
	conn.mu.Lock()
	if !conn.connected {
		conn.mu.Unlock()
		return nil
	}
	logging.Info("irc.Close(): Disconnected from server.")
	conn.connected = false
	err := conn.sock.Close()
	close(conn.die)
	// Drain both in and out channels to avoid a deadlock if the buffers
	// have filled. See TestSendDeadlockOnFullBuffer in connection_test.go.
	conn.drainIn()
	conn.drainOut()
	conn.wg.Wait()
	conn.mu.Unlock()
	// Dispatch after closing connection but before reinit
	// so event handlers can still access state information.
	conn.dispatch(&Line{Cmd: DISCONNECTED, Time: time.Now()})
	return err
}
1133263
func (cli *Client) Close() error {
	cli.Lock()
	defer cli.Unlock()
	defer close(cli.reply)
	return cli.conn.Close()
}
390104
func (s *SocketHub) Close() {
	if s.closed {
		return
	}
	s.closed = true
	close(s.closer)
}
809436
func (c *clientConn) Close() error {
	defer c.wg.Wait()
	return c.conn.Close()
}
1112071
func (c *SocketConnection) Close() error {
	if err := c.Conn.Close(); err != nil {
		return err
	}

	return nil
}
137936
func (c *Connection) Close() {
	if c.Closed {
		return
	}
	c.Closed = true

	if c.write != nil {
		c.writeWait.Wait()
		close(c.write)
	}
	if c.Notifications != nil {
		c.notificationWait.Wait()
		close(c.Notifications)
	}
	if c.conn != nil {
		_ = c.conn.Close()
	}

	log.Info(`Disconnected from Kodi`)
}
293991
func (c *Conn) Close() error {
	c.closeLock.Lock()
	defer c.closeLock.Unlock()
	if c.closed == true {
		return nil
	}

	c.closingLock.Lock()
	c.closing = true
	c.closingLock.Unlock()

	c.closed = true

	// close streams
	streams := c.Streams()
	for _, s := range streams {
		s.Close()
	}

	// close underlying connection
	c.swarm.removeConn(c)
	var err error
	if c.smuxConn != nil {
		err = c.smuxConn.Close()
	} else {
		err = c.netConn.Close()
	}
	c.swarm.notifyAll(func(n Notifiee) {
		n.Disconnected(c)
	})
	return err
}
1265020
func (c *connectionTracker) Close() {
	c.lock.Lock()
	defer c.lock.Unlock()
	for conn := range c.conns {
		if err := conn.Close(); err != nil {
			log.WithoutContext().Errorf("Error while closing connection: %v", err)
		}
		delete(c.conns, conn)
	}
}
261620
func (c *Connection) Close() error {
	if !c.returnOnClose {
		if c.Conn != nil {
			return c.Conn.Close()
		}
		return nil
	}
	c.owner.Release(c, nil)
	return nil
}
247882
func (conn *UnixConn) Close() error {
	close(conn.closeChan)
	return conn.unixConn.Close()
}
1136296
func (rpcClient *ReconnectRPCClient) Close() (err error) {
	rpcClient.mutex.Lock()
	netRPCClient := rpcClient.netRPCClient
	rpcClient.mutex.Unlock()

	if netRPCClient != nil {
		var status bool
		netRPCClient.Call("LockServer.Logout", &rpcClient.sessionID, &status)

		rpcClient.mutex.Lock()
		rpcClient.netRPCClient = nil
		rpcClient.mutex.Unlock()

		netRPCClient.Close()
	}

	return nil
}
834088
func (c *Client) Close(ctx context.Context) error {
	return c.client.Logout(ctx)
}
748346
func (c *MessageConnection) Close(closeCode int) error {
	// Call close on the base connection
	c.log("Closing websocket connection", LogLevelDebug)
	err := c.Connection.Close(closeCode)

	if err != nil {
		return err
	}

	// Do not close the receiver here since it would send nil
	// Just let go
	c.log("Connection closed", LogLevelInfo)

	return nil
}