Host notifies application of subscribe event before write response transmitted
- Dominant language
- C
- Stars
- 893
- Forks
- 512
- Avg merge
- 13d 31m
- Merged PRs (30d)
- 7
Description
#### Description
When a peer subscribes to a characteristic, the following sequence of events occurs:
1. Write request received (two-byte write to CCCD).
2. Host uses GAP event callback to tell application about subscription.
3. Host sends response to request from step 1.
The ordering of steps 2 and 3 is not ideal. If the application chooses to immediately send a notification or indication in step 2, the peer will receive it before the write response. It would be better if the host sent the response before it called the GAP event callback.
#### Possible implementation
On subscription, set a new flag in the CCCD entry and enqueue an event to the host event queue. When processed, the event would iterate the list of CCCDs, calling the GAP event callback for each whose flag is set.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the CCCD subscription handling, the write-response path, and the GAP event callback described in the issue; then inspect how the host event queue could defer the callback. Done means the write response is transmitted before the application receives the subscription event, including when it immediately sends a notification or indication.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100