go-ble / ble

Bluetooth Low Energy for Linux / macOS
BSD 3-Clause "New" or "Revised" License
305 stars 109 forks source link

linux: avoid hanging in Advertise*() and Scan() in case of HCI error #110

Closed huguesb closed 10 months ago

huguesb commented 11 months ago

Correctly propagate errors to avoid unrecoverable hanging in case of unexpected HCI error, such as disconnection of USB adapter.

Previously the internal goroutine with the Accept() loop would terminate but Scan() and all variants of Advertise() would just hang in such a situation, with no practical way for the surrounding application to detect or recover the error.

estutzenberger commented 10 months ago

Seems OK to me. Thanks for the PR!