Description
I'm using NimBLE 2.2.1 on an ESP32-S3.
I'm running a BLE server that allows up to 4 devices to connect. I have CONFIG_BT_NIMBLE_MAX_CONNECTIONS set to 4. I keep advertising unless I have 4 active connections.
I've noticed that when I have 2 connected clients, I can disconnect one (initiated from the client side), and I see an onDisconnect()
call, and the client will quickly reconnect. I can then disconnect from the other client, and I'll see an onDisconnect()
call, and the client will reconnect. I can continue alternating, and this keeps working.
But if I disconnect and reconnect from the same client 2 times in a row, the onDisconnect()
call is not called the 2nd time, and the server->getConnectedCount()
fails to decrement. After disconnecting a 3rd time in a row from the same client, there is still no onDisconnect()
call, the connected count reaches 4, advertising seems to stop, and my clients can no longer connect, although any remaining connected clients remain connected and continue working. At that point I need to reboot the ESP32 to get advertising to work again.
I'm seeing this problem when I disconnect/reconnect multiple times from my Mac, although I do not see the problem when I disconnect/reconnect repeatedly from an iPhone.