Re: [PATCH] Update SDP storage records when a record is deleted.

Jaikumar Ganesh
2009-10-29T21:04:36Z

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

Hi Johan:

On Thu, Oct 29, 2009 at 1:34 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi,
>
> They look so much better now :D

Attached.

>
> --
> Luiz Augusto von Dentz
> Engenheiro de Computação
>

[-- Attachment #2: 0001-Fix-handling-of-SDP-records.patch --]
[-- Type: text/x-diff, Size: 1857 bytes --]

From ab5b4da387bdd1d3461a8a45d05a4c6a13157e6a Mon Sep 17 00:00:00 2001
From: Jaikumar Ganesh <jaikumar@google.com>
Date: Thu, 29 Oct 2009 14:01:36 -0700
Subject: [PATCH] Fix handling of SDP records.

We were deleting the SDP records only if a device was registered for
those UUIDs. With this change, we delete the SDP records even if there
are no drivers registered.
---
src/device.c | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/device.c b/src/device.c
index 5585271..69a68db 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1136,8 +1136,6 @@ static void device_remove_drivers(struct btd_device *device, GSList *uuids)
next = list->next;

for (uuid = driver->uuids; *uuid; uuid++) {
- sdp_record_t *rec;
-
if (!g_slist_find_custom(uuids, *uuid,
(GCompareFunc) strcasecmp))
continue;
@@ -1150,24 +1148,28 @@ static void device_remove_drivers(struct btd_device *device, GSList *uuids)
driver_data);
g_free(driver_data);

- rec = find_record_in_list(records, *uuid);
- if (!rec)
- break;
+ break;
+ }
+ }

- delete_record(srcaddr, dstaddr, rec->handle);
+ for (list = uuids; list; list = list->next) {
+ sdp_record_t *rec;

- records = sdp_list_remove(records, rec);
- sdp_record_free(rec);
+ device->uuids = g_slist_remove(device->uuids, list->data);
+
+ rec = find_record_in_list(records, list->data);
+ if (!rec)
+ continue;
+
+ delete_record(srcaddr, dstaddr, rec->handle);
+
+ records = sdp_list_remove(records, rec);
+ sdp_record_free(rec);

- break;
- }
}

if (records)
sdp_list_free(records, (sdp_free_func_t) sdp_record_free);
-
- for (list = uuids; list; list = list->next)
- device->uuids = g_slist_remove(device->uuids, list->data);
}

static void services_changed(struct btd_device *device)
--
1.6.2.3