Critical bug fix: Discarding packets fixed? #567
Merged
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 PR fixes #300. It may be related to #439 and #228 or #218.
Issue
During reassembly packets of a single segmented message may be received in arbitrary order and should be accepted. It is possible to get higher SEQ before a lower one, due to a packet loss, for example.
For that reason long time ago in lower transport layer a check has been added:
IOS-nRF-Mesh-Library/nRFMeshProvision/Layers/Lower Transport Layer/LowerTransportLayer.swift
Lines 386 to 399 in 0070766
In case the
reassemblyInProgress
flag was set, the packet was not discarded if the SeqAuth of the segmented message (that is calculated using IV Index, SEQ of the received message andseqZero
of the segment) was equal to the SeqAuth of currently reassembled message:IOS-nRF-Mesh-Library/nRFMeshProvision/Layers/Lower Transport Layer/LowerTransportLayer.swift
Lines 418 to 423 in 0070766
However, as you know, life is not that easy. Have a look at the log:
As the last ACK increased the SEQ for the device to 14356 the phone discards the packet. Instead, it should process, check that it is the same segment repeated, and resend ACK. Otherwise the transmitter will not be able to proceed with next message.
The change removes the check for received and local SeqAuth, allowing some packets to come in between.
Note
I'm not 100% it's not a bug on the device side, that it's sending some packets in-between another transfer, but as others also experienced discarding packets, this change should help.