Fix l2cap segmentation error in concurrent subscription #28
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.
We are having some issues when we subscribe to different characteristics in the same server and get data from them simultaneously, we are getting corrupted packages.
After some research we discovered that the problem was in l2cap layer, segments were being mixed and this was causing reassembly inconsistencies.
When l2cap layer needs to fragment the packets, it seems this layer does not support unordered segments. With this patch we ensure these segments are sent in order for each upper-layer's packet.
As an example, we need to send two packets of 135 bytes, so l2cap layer needs to fragment it in 5 segments of 27 bytes.
On the other side, we would receive something like (P1=Packet1, P2=Packet2):
With this patch we aim to solve this. See orca-io@edd7ec2