Hi,
no you do not need to call destroy(). That is only to clean up
resources when you don't need a client object at all. If the
client object is the last or only one, then destroy() also cleans
up resources for the entire library, which has caused some issues
under some circumstances. It's a plan of mine to separate out
this library cleanup code into a separate, explicitly called
function to avoid those issues entirely but I have not done that
yet.
Definitely don't call destroy() unless you really have finished
with the client object. There is no need to recreate during a
long running process, just re-connect.
Ian
On 22/05/2019 07:51, Durgesh Tanuku
wrote:
Hi,
Our application using paho c mqtt library (version 1.3.0).
Recently we have noticed few issues (mostly crashes in
library) when application is reconnecting (disconnection,
destroy and then connect) to the broker. We are reconnecting
to broker when MQTTClient_isConnected() returns false. As I'm
new to paho library, I have below queries designing
application code with respect to paho library.
1) If underlying library is disconnected from broker due to
any network issue, does the application need to reset the
connection by destroying existing mqtt client handle ?
2) Can application code use the handle created at
initialisation during entire run time of the process ? Will
there be any case where application need to reset the existing
connection ?
The device on which our application runs, might switch the
interfaces and cause network issues.
Thanks,
Durgesh
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/paho-dev
--
Ian Craggs
icraggs@xxxxxxxxxx IBM United Kingdom
Eclipse Paho Project Lead & Mosquitto Committer
_______________________________________________