mosquitto
mosquitto copied to clipboard
mosquitto_disconnect stops the network loop but mosquitto_connect doesn't start it.
This is more of an unexpected behavior on my part and maybe I just haven't found the right documentation.
I assumed I could call the following sequence and the client would just resume running the loop after the second connect.
mosquitto_loop_start(mosq);
mosquitto_connect_async(mosq);
sleep(10);
mosquitto_disconnect(mosq);
sleep(10);
mosquitto_connect_async(mosq);
sleep(10);
mosquitto_loop_stop(mosq);
But instead, I have to call mosquitto_loop_start again after mosquitto_disconnect. Otherwise I won't get the connect callback on the second mosquitto_connect_async.
I believe it's because of the following lines: https://github.com/eclipse/mosquitto/blob/master/lib/loop.c#L297-L298 https://github.com/eclipse/mosquitto/blob/master/lib/loop.c#L320-L321
Mosquitto Version: 2.0.14