-
Notifications
You must be signed in to change notification settings - Fork 111
MQTTv5 Implementation #316
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
base: main
Are you sure you want to change the base?
Conversation
/bot run formatting |
* duplicate incoming publishes. */ | ||
* before sending acks. */ | ||
|
||
reasonCode = MQTT_REASON_PUBREC_SUCCESS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't the callback modify this value? Why are we explicitly setting this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the callback has the option to modify the reason code. The reason code has been initialized to this defualt value in the case where the callback does not modify this value. According to the v5 spec, In the Publish Ack packets, if the Remaining Length is 2, then there is no Reason Code and the value of 0x00 (Success) is used.
MQTT_REASON_PUBREC_SUCCESS (0x00) is just the default value to indicate no modification of the reason code.
|
||
if( ( ackPropsAdded == false ) && ( reasonCode == MQTT_REASON_PUBREC_SUCCESS ) ) | ||
{ | ||
status = sendPublishAcks( pContext, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remind me why are we not using MQTT_PRE_SEND_HOOK
and POST send hooks here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We changed MQTT_PRE_SEND_HOOK
and MQTT_POST_SEND_HOOK
into just MQTT_PRE_STATE_UPDATE_HOOK
and MQTT_POST_STATE_UPDATE_HOOK
and shifted the hooks inside the sendPublishAcks
function ( to make it thread - safe ). These hooks are then called while sending a packet as well as updating the state. Removed the send hooks from the sendPublishAcksWithProperty()
as well.
Upgrading MQTT Library to support v5 features
Description
Test Steps
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.