Open MartinKlang opened 1 year ago
I don't know why the CI fails, could it be an intermittent problem? It passes locally:
[MQTT-C API Tests]
[==========] Running 3 test(s).
[ RUN ] TEST__api__connect_ping_disconnect
[ OK ] TEST__api__connect_ping_disconnect
[ RUN ] TEST__api__publish_subscribe__single
[ OK ] TEST__api__publish_subscribe__single
[ RUN ] TEST__api__publish_subscribe__multiple
[ OK ] TEST__api__publish_subscribe__multiple
[==========] 3 test(s) run.
[ PASSED ] 3 test(s).
This PR fixes a bug that can cause problems when calling mqtt_reinit(), for example from the reconnect callback.
If the connection is re-established while sending multi-part messages then MQTT-C will send garbage data from an old offset into the re-initialised message queue. Ultimately leading to junk being sent to the host.
This behaviour has been observed in the wild on devices with intermittent network connections.