Skip to content

fix(ble): drive the Windows BLE receiver from events instead of a 50 … - #88

Merged
asulwer merged 1 commit into
masterfrom
fix/60-ble-receiver-events
Oct 26, 2026
Merged

asulwer merged 1 commit into
masterfrom
fix/60-ble-receiver-events

Conversation

@asulwer

@asulwer asulwer commented Oct 26, 2026

Copy link
Copy Markdown
Owner

…ms loop

The thread that owns the GATT objects now sleeps until something changes: a message to send, an indication completing, a session ending, the advertisement status or subscribers changing, a BLE send starting or ending, visibility, or cancel. The 50 ms tick also capped outbound at about 20 indications a second; the next packet now goes as soon as the last is confirmed.

The fixed waits go with it. The recycle waits for the phone to leave the link instead of sleeping 500 ms, with a 2 s limit standing in for that event in case Windows keeps a client. The drain before the switch takes what the duplex already holds instead of waiting 200 ms for more (Linux too). The 5 s limit on each indication is replaced by the switch it stood in for: once a session moves to its upgraded socket, its remaining packets go out without waiting on confirmations the phone has stopped sending. The 3 s and 10 s drain limits now end on the link dropping, the 45 s first-byte limit is gone (the phone closing the socket ends the copy), and the ConnectionConfirm retries end with the session instead of after 5.

Closes #60

…ms loop

The thread that owns the GATT objects now sleeps until something changes: a message to send, an indication completing, a session ending, the advertisement status or subscribers changing, a BLE send starting or ending, visibility, or cancel. The 50 ms tick also capped outbound at about 20 indications a second; the next packet now goes as soon as the last is confirmed.

The fixed waits go with it. The recycle waits for the phone to leave the link instead of sleeping 500 ms, with a 2 s limit standing in for that event in case Windows keeps a client. The drain before the switch takes what the duplex already holds instead of waiting 200 ms for more (Linux too). The 5 s limit on each indication is replaced by the switch it stood in for: once a session moves to its upgraded socket, its remaining packets go out without waiting on confirmations the phone has stopped sending. The 3 s and 10 s drain limits now end on the link dropping, the 45 s first-byte limit is gone (the phone closing the socket ends the copy), and the ConnectionConfirm retries end with the session instead of after 5.

Closes #60
@asulwer
asulwer merged commit 252df26 into master Oct 26, 2026
10 checks passed
@asulwer
asulwer deleted the fix/60-ble-receiver-events branch October 26, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows BLE receiver: replace the 50 ms loop and fixed waits with events

1 participant