Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset client->send_offset on reinit #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MartinKlang
Copy link
Contributor

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.

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
@MartinKlang
Copy link
Contributor Author

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).

@MartinKlang MartinKlang closed this Jun 8, 2023
@MartinKlang MartinKlang reopened this Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant