2023-08-19 19:57:22

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 2/2] device: Restart temporary timer while connecting

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

If the device is temporary restart its timer when attempt to connect to
it since it can interrupt the connection attempt prematurely while it
still scanning, etc.
---
src/device.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/device.c b/src/device.c
index f6b0167bf55b..9b58e0c4e6c5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5754,6 +5754,10 @@ int device_connect_le(struct btd_device *dev)
/* Keep this, so we can cancel the connection */
dev->att_io = io;

+ /* Restart temporary timer to give it time to connect/pair, etc. */
+ if (dev->temporary)
+ set_temporary_timer(dev, btd_opts.tmpto);
+
return 0;
}

--
2.41.0