axl_bool myqtt_conn_close ( MyQttConn connection)

Allows to cleanly close the connection by sending the DISCONNECT control packet.

After the connection is closed it must not be used. If no other references are acquired to the connection, it is then released (resources).

In the case the connection is a listener or a master listener, it is just closed without sending DISCONNECT message.

connectionThe connection to be closed.
axl_true if the connection was closed, otherwise axl_false is returned.

References msg, myqtt_conn_get_timeout(), myqtt_conn_is_ok(), myqtt_conn_opts_free(), myqtt_conn_ref(), myqtt_conn_unref(), MYQTT_DISCONNECT, myqtt_mutex_lock(), myqtt_mutex_unlock(), myqtt_sleep(), MyQttConnectionCloseCalled, MyQttError, MyQttRoleInitiator, and MyQttRoleMasterListener.

Referenced by myqtt_conn_is_ok().