fix: send_ack_packet no longer causes unexpected behaviour if shared data lib fails to send #64
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.
Hi,
This is a pull request to fix a bug contained in the provisioning library which can cause the provisioning library to exit early and enter an invalid state.
Bug
When a failure occurs while sending an
ack
packet to the provisioning server using the shared data library the failure is handled by returningAPP_SCHEDULER_SCHEDULE_ASAP
. This causes the state machine to exit early and the library to be "stuck" in the state. Consequently, the initiator's end of provisioning callback is never called so it may stall the behaviour of their system awaiting this call.Furthermore, the code explicitly states in a comment that the ACK is optional and in the event of a failure the provisioning process should move to the next state; which it does not in this case.
Proposed fix
The fix proposed in this pull request instead handles this as an "immediate timeout". This causes a timeout event to occur and the system to proceed as usual.
An alternative fix could be to explicitly set
m_events.timeout = 1
instead of starting the timeout task (which does this).