device: Fix not removing temporary timer when connected
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Sat, 18 Jul 2020 00:25:52 +0000 (17:25 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
Devices with random addresses will not have its temporary flag (as they
cannot be persisted in storage) reset even in case they are connected
which could cause and unintended disconnection.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/device.c

index 7f2874333b575675738831b6838d344fd6a542c8..9f58ff0e756ca98c5561fc716db6a21fe335142f 100644 (file)
@@ -4716,6 +4716,12 @@ void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type)
        if (dev->le_state.connected && dev->bredr_state.connected)
                return;
 
+       /* Remove temporary timer while connected */
+       if (dev->temporary_timer) {
+               g_source_remove(dev->temporary_timer);
+               dev->temporary_timer = 0;
+       }
+
        g_dbus_emit_property_changed(dbus_conn, dev->path, DEVICE_INTERFACE,
                                                                "Connected");
 #else