in uamqp/client.py [0:0]
def close(self):
"""Close the client. This includes closing the Session
and CBS authentication layer as well as the Connection.
If the client was opened using an external Connection,
this will be left intact.
No further messages can be sent or received and the client
cannot be re-opened.
All pending, unsent messages will remain uncleared to allow
them to be inspected and queued to a new client.
"""
if self.message_handler:
self.message_handler.destroy()
self.message_handler = None
self._shutdown = True
if self._keep_alive_thread:
try:
self._keep_alive_thread.join()
except RuntimeError: # Probably thread failed to start in .open()
logging.info("Keep alive thread failed to join.", exc_info=True)
self._keep_alive_thread = None
if not self._session:
return # already closed.
if not self._connection._cbs: # pylint: disable=protected-access
_logger.debug("Closing non-CBS session.")
self._session.destroy()
else:
_logger.debug("CBS session pending.")
self._session = None
if not self._ext_connection:
_logger.debug("Closing exclusive connection.")
self._connection.destroy()
else:
_logger.debug("Shared connection remaining open.")
self._connection = None