Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] persistent_client_expiration, async connections with libmosquitto, and topic subscriptions

So far I've posted two questions here and haven't received any response whatsoever, don't know if I'm asking bad questions - I hope not.

Previously I started with the assumption that I've started a mosquitto connection with clean_session=true with an  async connection, then called mosquitto_loop_start().

I had noticed that in the event that the broker unexpectedly disconnects a connection it appears that libmosquitto will attempt to reconnect.  Since I had used clean_session=true it also appears that any existing subscriptions will be lost (am I correct in this???) which means that a client with subscriptions will need to set an on_disconnect callback not to reconnect, but to resubscribe to previous subscriptions.  This seems a little odd to me if correct that the library tries to be so helpful about re-establishing the connection but then requires manual intervention to resubscribe.

If this is true it would seem to encourage clients to connect with clean_session=false.  But then according to the documentation for mosquitto.conf for the persistent_client_expiration option "Badly designed clients may set clean session to false whilst using a randomly generated client id."  This sounds like unless this option is set clients which set clean session to false whilst using a randomly generated client id effectively set up a potential resource leak on the server which opens up a denial of service attack.

I'm trying to follow along with the code and intent here and could really use some clarification.

Steve Prior

Back to the top