~Adjusts MQTT311's disconnect behavior to not always free the native resources when disconnect() is called, instead adding a new option (close_on_disconnect) that can be set to false, allowing for manual reconnects. Also exposes the close() function so the connection can be cleaned manually if close_on_disconnect is set to false.~
~Also fixes a number of segfaults that can occur if the MQTT311 connection is closed. Now errors are thrown explaining that the MQTT311 connection has been closed and is no longer usable, rather than segfaulting.~
~Adding documentation for these new functions and tests to ensure functionality works as expected by default, and with the new option.~
Fixes segfaults that occur when you call connect, disconnect, and then connect again, or if you call disconnect and then try to perform any other operations (subscribe, unsubscribe, publish, etc). Also adjusts documentation a bit, and adds a couple tests to ensure the current behavior works as expected without segfaults.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description of changes:
~Adjusts MQTT311's disconnect behavior to not always free the native resources when
disconnect()
is called, instead adding a new option (close_on_disconnect
) that can be set tofalse
, allowing for manual reconnects. Also exposes theclose()
function so the connection can be cleaned manually ifclose_on_disconnect
is set tofalse
.~~Also fixes a number of segfaults that can occur if the MQTT311 connection is closed. Now errors are thrown explaining that the MQTT311 connection has been closed and is no longer usable, rather than segfaulting.~
~Adding documentation for these new functions and tests to ensure functionality works as expected by default, and with the new option.~
Fixes segfaults that occur when you call
connect
,disconnect
, and thenconnect
again, or if you calldisconnect
and then try to perform any other operations (subscribe, unsubscribe, publish, etc). Also adjusts documentation a bit, and adds a couple tests to ensure the current behavior works as expected without segfaults.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.