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

MQTT: Cleanup code regarding retain flag and add test #4443

Merged
merged 1 commit into from Aug 29, 2023

Conversation

kozlovic
Copy link
Member

As per specification MQTT-3.3.1-8, we are now setting the RETAIN flag when delivering to new subscriptions and clear the flag in all other conditions.

Signed-off-by: Ivan Kozlovic ivan@synadia.com

As per specification MQTT-3.3.1-8, we are now setting the RETAIN
flag when delivering to new subscriptions and clear the flag in
all other conditions.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
@kozlovic kozlovic requested a review from a team as a code owner August 29, 2023 18:45
@kozlovic kozlovic requested a review from levb August 29, 2023 18:45
@derekcollison
Copy link
Member

This only for dev or should be for main too?

@kozlovic
Copy link
Member Author

@derekcollison There have been "many" other fixes in Lev's PR that was against dev branch that we felt that this fix is ok to be in dev only. That being said, I can make it against "main" branch but there would be conflict merging into "dev" due to recent changes.

@derekcollison
Copy link
Member

If applicable to main yes let's do that..

@kozlovic
Copy link
Member Author

If applicable to main yes let's do that..

Ok will do so in a bit.

@kozlovic kozlovic changed the base branch from dev to main August 29, 2023 22:04
@kozlovic kozlovic changed the base branch from main to dev August 29, 2023 22:04
@kozlovic kozlovic changed the title [FIXED] MQTT: Retain flag did not always have the correct value. MQTT: Cleanup code regarding retain flag and add test Aug 29, 2023
@kozlovic
Copy link
Member Author

@derekcollison @levb After further review, there was no bad behavior in that the retain flag was cleared (as expected) when processing a retained message, which means that the code in the "QoS0" callback that used the retain flag value to serialize the message to an existing subscription would have always be "false" (as it should). For the "QoS1" callback, the retain boolean was declared but never set, so again the end-result was correct behavior.

I have changed the title of this PR to make it clear that this is more of a code cleanup, no defect is being fixed. I therefore propose to leave this against "dev" and not have a PR for "main" since there was no defect per-se.

Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekcollison derekcollison merged commit a64f7a0 into dev Aug 29, 2023
2 checks passed
@derekcollison derekcollison deleted the mqtt_fix_retain_flag branch August 29, 2023 22:58
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.

None yet

2 participants