Add request message to CoAP response callback function #50
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.
This pull request is a suggestion to add the CoAP request message as parameter to the CoAP response callback function.
Why is this useful ?
This allows to take better action on a transmission failures. By having access to the original message, we have access to the message ID and data. We can check the ID and data and if needed store back the message to memory to send it later and avoid any data loss. Currently when the transmission fails after the retries, the
pRespMsg
value is NULL so we don't have any info on the request it is related to and can't take any action.WARNING
This change breaks the API, however it is not that big of a deal since it only requires you to add the
pReqMsg
parameter to all of your (probably very few) CoAP response callback function definitions.