2024-03-18 16:08:44

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1] device: Fix device_is_connected checking for services being connected

From: Luiz Augusto von Dentz <[email protected]>

Change 44d3f67277f83983e1e9697eda7b9aeb40ca231d since to have introduced
quite a few bugs related to device_is_connected return true which
prevents proper cleanup of connection.

Fixes: https://github.com/bluez/bluez/issues/774
Fixes: https://github.com/bluez/bluez/issues/778
Fixes: https://github.com/bluez/bluez/issues/783
Fixes: https://github.com/bluez/bluez/issues/784
---
src/device.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/device.c b/src/device.c
index aecceb100..b5b574233 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3324,22 +3324,24 @@ void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type,
"Connected");
}

+static bool device_service_connected(struct btd_device *dev)
+{
+ if (find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTING))
+ return true;
+
+ return find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTED);
+}
+
static bool device_disappeared(gpointer user_data)
{
struct btd_device *dev = user_data;

- if (btd_device_is_connected(dev)) {
- char addr[18];
- ba2str(&dev->bdaddr, addr);
- DBG("Device %s is marked as connected", dev->path);
- return TRUE;
- }
-
- /* If there are services connecting restart the timer to give more time
+ /* If there are services connected restart the timer to give more time
* for the service to either complete the connection or disconnect.
*/
- if (find_service_with_state(dev->services,
- BTD_SERVICE_STATE_CONNECTING))
+ if (device_service_connected(dev))
return TRUE;

dev->temporary_timer = 0;
--
2.44.0



2024-03-18 19:20:35

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v1] device: Fix device_is_connected checking for services being connected

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Mon, 18 Mar 2024 16:08:31 +0000 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> Change 44d3f67277f83983e1e9697eda7b9aeb40ca231d since to have introduced
> quite a few bugs related to device_is_connected return true which
> prevents proper cleanup of connection.
>
> Fixes: https://github.com/bluez/bluez/issues/774
> Fixes: https://github.com/bluez/bluez/issues/778
> Fixes: https://github.com/bluez/bluez/issues/783
> Fixes: https://github.com/bluez/bluez/issues/784
>
> [...]

Here is the summary with links:
- [BlueZ,v1] device: Fix device_is_connected checking for services being connected
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8060d1208673

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html