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

Avoid reusing packet IDs immediately #443

Merged
merged 1 commit into from Sep 18, 2020
Merged

Avoid reusing packet IDs immediately #443

merged 1 commit into from Sep 18, 2020

Conversation

MattBrittan
Copy link
Contributor

This fixes #442 (in an unsatisfactory way; the cause of the issue is not clear and this was supposed to aid in tracing it).
Previouslly the message id was always the first integer that was unallocated (always searching up from ID 1) meaning that messageids were reused fairly quickly. This pull request changes that so that the message id will be the first free id after the one most recently issued (meaning that ids will generally be sequential and only wrap around after 65535 messages).
There seems no downside to minimising the reuse of IDs and doing so makes it easier to trace messages in broker logs. I believe that this method also mirrors how mosquitto allocates ids.

This fixes #442 (in an unsatisfactory way; the cause of the issue is
not clear and this was supposed to aid in tracing it).
There seems no downside to minimising the reuse of IDs and doing
so makes it easier to trace messages in broker logs.
Signed-off-by: Matt Brittan <matt@brittan.nz>
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.

Small percentage of messages lost (via Mosquitto) - high frequency messages from single publisher
2 participants