-
Notifications
You must be signed in to change notification settings - Fork 105
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
Enabling Unclean Session Publish Re-Transmits #308
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DakshitBabbar
requested review from
aggarg,
AniruddhaKanhere,
archigup,
amazonKamath and
tony-josi-aws
September 27, 2024 06:51
archigup
previously approved these changes
Oct 17, 2024
Add opaque struct and functions to serialize it.
AniruddhaKanhere
previously approved these changes
Oct 22, 2024
archigup
reviewed
Oct 23, 2024
archigup
reviewed
Oct 23, 2024
archigup
reviewed
Oct 23, 2024
archigup
reviewed
Oct 23, 2024
AniruddhaKanhere
force-pushed
the
reTransmit
branch
3 times, most recently
from
October 24, 2024 04:45
6d7affb
to
d8d3abb
Compare
AniruddhaKanhere
force-pushed
the
reTransmit
branch
from
October 24, 2024 04:49
d8d3abb
to
a643f7f
Compare
archigup
reviewed
Oct 24, 2024
archigup
reviewed
Oct 24, 2024
AniruddhaKanhere
force-pushed
the
reTransmit
branch
from
October 24, 2024 21:29
9ef8b87
to
1a51eef
Compare
AniruddhaKanhere
force-pushed
the
reTransmit
branch
from
October 24, 2024 21:37
1a51eef
to
74fa43f
Compare
archigup
approved these changes
Oct 24, 2024
AniruddhaKanhere
approved these changes
Oct 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR enables the coreMQTT library to resend unacked publishes on an unclean session connection.
Following is a brief summary of changes:
MQTT_InitRetransmits
that will initialise the context to handle publish retransmits on an unclean session connectiona. copy and store outgoing publishes
b. retrieve copied publish on an unclean session connection to resend
c. clear a copied publish when a
PUBACK
/PUBREC
is receivedd. clear all copied publishes on a clean session connection
Following are the specifics of the changes:
MQTTContext_t
to hold the callback function pointersa.
MQTTRetransmitStorePacket storeFunction
b.
MQTTRetransmitRetrievePacket retrieveFunction
c.
MQTTRetransmitClearPacket clearFunction
d.
MQTTRetransmitClearAllPackets clearAllFunction
MQTT_Status_strerror
function to handle the newMQTTStatus_t
valuesMQTT_InitRetransmits
that will initialise the new callback functions in theMQTTContext_t
MQTT_Publish
a. copy the outgoing publish packet in form of an array of
TransportOutVector_t
if the callback if definedb. if copy fails then bubble up corresponding error status code
MQTT_ReceiveLoop
a. on receiving a
PUBACK
/PUBREC
clear the copy of that particular publish after the state of the publish record has been successfully updated, if the callback if definedMQTT_Connect
a. on a clean session clear all the copies of publishes stored if the callback is defined
b. if clear all fails then bubble up corresponding error status code
c. on an unclean session get the packetID of the unacked publishes and retrieve the copies of those if the callback is defined
d. if retrieve fails then bubble up corresponding error status code
Approaches Taken
TransportOutVector_t
PUBACK
/PUBREC
the copy will be cleared after the state of the publish record is changed so that if state update fails the copy won't be cleared. Otherwise if the state does not change and the copy is cleared then when a connection is made with an unclean session there will be a retrieve fail as the system is in an inconsistent state.TransportOutVector_t
that holds the data in aconst
pointer which cannot be changed after retrieving.Pending Tasks