diff mbox series

[BlueZ,v1] device: Fix device_is_connected checking for services being connected

Message ID 20240318160831.354442-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 8060d1208673826665b7297c27aa75003521b52a
Headers show
Series [BlueZ,v1] device: Fix device_is_connected checking for services being connected | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS

Commit Message

Luiz Augusto von Dentz March 18, 2024, 4:08 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

Comments

patchwork-bot+bluetooth@kernel.org March 18, 2024, 7:20 p.m. UTC | #1
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 18 Mar 2024 16:08:31 +0000 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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!
diff mbox series

Patch

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;