Skip to content

Comments

fix(hci): Check stop flag periodically, even without incoming data#12

Merged
stoprocent merged 1 commit intostoprocent:mainfrom
wwaaijer:main
Feb 20, 2026
Merged

fix(hci): Check stop flag periodically, even without incoming data#12
stoprocent merged 1 commit intostoprocent:mainfrom
wwaaijer:main

Conversation

@wwaaijer
Copy link

Fixes stoprocent/noble#30 and stoprocent/bleno#11.

This adds a read timeout to the HCI Linux socket using SO_RCVTIMEO (see socket(7)), allowing the poll thread to check the stop flag even when there is no activity on the socket.

Alternatives considered:

  • Immediate socket close - couldn't guarantee pending commands reach the HCI device
  • Explicit wait for specific response events - would require significant additional code in both Bleno's and Noble's clean up process

Happy to discuss or elaborate!

@fquirin
Copy link

fquirin commented Feb 19, 2026

I highly recommend to merge this PR. I've tested it on Raspberry Pi 4, OS 13 (Trixie) and it solved my issue with the unresponsive PollSocket thread.
As far as I understand the fix does not introduce any potential issues with other systems and is a "common" procedure on Linux (according to "AI" 😏).

@stoprocent
Copy link
Owner

can you rebase?

@wwaaijer
Copy link
Author

Done ✅

@stoprocent stoprocent merged commit b3f7ded into stoprocent:main Feb 20, 2026
15 checks passed
@github-actions
Copy link

🎉 This PR is included in version 2.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Noble.stop() sometime hangs

3 participants