-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Coming from v0.6, I was exited to upgrade Bleno to use the multiple connections support.
But I ran into an issue.
Reduced to a simple Bleno peripheral setup with a battery level service (read-only).
Client connects, reads the battery level, and disconnects after 3 seconds.
Everything works fine, until disconnecting.
When the client disconnects, the Node.js process just hangs and never emits the disconnect event.
Traced the issue with some logging throughout the disconnection process:
- Internally the
disconnCompleteevent is emitted by the (main) hci-socket - Bleno starts closing the internal
aclStreambelonging to the specific handle - Which calls
stop()on the hci socket (owned by the Mgmt class) - This gets to
BluetoothHciSocketWrapped.stop()in@stoprocent/bluetooth-hci-socket/lib/native.js - From there, the Node.js process just hangs
Currently I lack the tools or expertise to debug the C++ code.
However, i would guess in BluetoothHciSocket.cpp that the pollingThread.join() is never returning for some reason?
Is the read call blocking, waiting for the socket to be closed, first?
Seems to have been working until just before v0.9.0, when the multiple connections support was added.
Running on a Raspberry Pi 3 B+ with Linux raspberrypi 6.1.21-v8, updated everything, Node.js v24.
P.S. already had great fun with your version of Bleno, thanks for your work on it!