def open()

in uamqp/client.py [0:0]


    def open(self, connection=None):
        """Open the client. The client can create a new Connection
        or an existing Connection can be passed in. This existing Connection
        may have an existing CBS authentication Session, which will be
        used for this client as well. Otherwise a new Session will be
        created.

        :param connection: An existing Connection that may be shared between
         multiple clients.
        :type connetion: ~uamqp.connection.Connection
        """
        # pylint: disable=protected-access
        if self._session:
            return  # already open.
        _logger.debug("Opening client connection.")
        try:
            if connection:
                _logger.debug("Using existing connection.")
                self._auth = connection.auth
                self._ext_connection = True
                connection.lock()
            self._connection = connection or self.connection_type(
                self._hostname,
                self._auth,
                container_id=self._name,
                max_frame_size=self._max_frame_size,
                channel_max=self._channel_max,
                idle_timeout=self._idle_timeout,
                properties=self._properties,
                remote_idle_timeout_empty_frame_send_ratio=self._remote_idle_timeout_empty_frame_send_ratio,
                error_policy=self._error_policy,
                debug=self._debug_trace,
                encoding=self._encoding)
            self._build_session()
            if self._keep_alive_interval:
                self._keep_alive_thread = threading.Thread(target=self._keep_alive)
                self._keep_alive_thread.daemon = True
                self._keep_alive_thread.start()
        finally:
            if self._ext_connection:
                connection.release()