Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

LLCP updates are not applied when the event is missed #74

Open
jonas-schievink opened this issue Aug 30, 2019 · 1 comment
Open

LLCP updates are not applied when the event is missed #74

jonas-schievink opened this issue Aug 30, 2019 · 1 comment
Labels
area: link layer Code Area: BLE Link Layer (establishing and maintaining connections, encryption, etc) good first issue Call for participation: Good for newcomers status: needs code An implementation or a bugfix need to be written type: bug Something isn't behaving as intended
Milestone

Comments

@jonas-schievink
Copy link
Owner

When we've stored an LLCP update, we need to apply it to the connection state after the correct connection event number (or "instant"). Currently, this is done here:

// Next conn event will the the first one with these parameters.
let result = self.apply_llcp_update(update, rx_end);
info!("LLCP patch applied: {:?} -> {:?}", update, result);
if let Some(cmd) = result {
return Ok(cmd);
}

However, this code is inside the RX handler, so if we happen to miss the event we're supposed to apply the update, we never do so, resulting in the connection being lost completely. This can be seen in the following log:

2.888649s - TRACE - #18 DATA(15->22)<- Header { LLID: DataCont, NESN: 1, SN: 1, MD: false, Length: 0 }, []
2.889144s - INFO - LLCP<- ConnectionUpdateReq(ConnectionUpdateData { win_size: 2, win_offset: 17, interval: 39, latency: 0, timeout: 500, instant: 29 })
...
2.963649s - TRACE - #28 DATA(11->18)<- Header { LLID: DataCont, NESN: 1, SN: 1, MD: false, Length: 0 }, []
2.964147s - TRACE - DATA(18->25): missed conn event #29
2.972340s - TRACE - DATA(25->32): missed conn event #30
2.980533s - TRACE - DATA(32->2): missed conn event #31
2.988725s - TRACE - DATA(2->16): missed conn event #32
2.996940s - TRACE - DATA(16->16): missed conn event #33
...

Event 29 is missed presumably due to interference, we never apply the update, all future events are missed because the connection state is now desynced.

@jonas-schievink jonas-schievink added type: bug Something isn't behaving as intended status: needs code An implementation or a bugfix need to be written area: link layer Code Area: BLE Link Layer (establishing and maintaining connections, encryption, etc) labels Aug 30, 2019
@jonas-schievink
Copy link
Owner Author

A good way to fix this would probably be to move the code that hops channels and applies the LLCP update into its own function (close_connection_event?) and just call it from the 2 places.

@jonas-schievink jonas-schievink added this to the 0.1.0 milestone Sep 23, 2019
@jonas-schievink jonas-schievink added the good first issue Call for participation: Good for newcomers label Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: link layer Code Area: BLE Link Layer (establishing and maintaining connections, encryption, etc) good first issue Call for participation: Good for newcomers status: needs code An implementation or a bugfix need to be written type: bug Something isn't behaving as intended
Projects
None yet
Development

No branches or pull requests

1 participant