device: clear eir_uuids list on disconnect
authorDavid Lechner <david@lechnology.com>
Wed, 25 Aug 2021 16:51:24 +0000 (11:51 -0500)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:36 +0000 (19:08 +0530)
The eir_uuids list contains GATT service UUIDs from advertising data.
The device may advertise different UUIDs each time it is scanned and
connected, so the list needs to be cleared when the device disconnects.

This partially fixes an issue where the UUIDs D-Bus property is empty
after scanning, connecting, disconnecting and scanning again when
[GATT] Cache = yes is set in main.conf.

Issue: https://github.com/bluez/bluez/issues/192
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/device.c

index cf8bec9..105b511 100644 (file)
@@ -5577,6 +5577,9 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 
        device_update_last_seen(device, bdaddr_type);
 
+       g_slist_free_full(device->eir_uuids, g_free);
+       device->eir_uuids = NULL;
+
        g_dbus_emit_property_changed(dbus_conn, device->path,
                                                DEVICE_INTERFACE, "Connected");