summaryrefslogtreecommitdiff
path: root/src/attrib-server.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2011-10-04 14:52:23 -0300
committerJohan Hedberg <johan.hedberg@intel.com>2011-10-05 11:16:24 +0300
commit6c729fd1ec29c0d19bce15f0e31aef7e0398e726 (patch)
tree1153810645e18db8a8df41f81e42812ddea399eb /src/attrib-server.c
parentaa9e4e4b3029e47e5c27287e93ba985144b0a0fb (diff)
downloadbluez-6c729fd1ec29c0d19bce15f0e31aef7e0398e726.tar.gz
Minor cleanup in attrib server channel disconnect
Diffstat (limited to 'src/attrib-server.c')
-rw-r--r--src/attrib-server.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 5a50aded1..95efd9f78 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -783,12 +783,8 @@ static void attrib_free(void *data)
g_free(a);
}
-static void channel_disconnect(void *user_data)
+static void channel_free(struct gatt_channel *channel)
{
- struct gatt_channel *channel = user_data;
-
- clients = g_slist_remove(clients, channel);
-
g_slist_free(channel->notify);
g_slist_free(channel->indicate);
g_slist_free_full(channel->configs, attrib_free);
@@ -797,6 +793,14 @@ static void channel_disconnect(void *user_data)
g_free(channel);
}
+static void channel_disconnect(void *user_data)
+{
+ struct gatt_channel *channel = user_data;
+
+ clients = g_slist_remove(clients, channel);
+ channel_free(channel);
+}
+
static void channel_handler(const uint8_t *ipdu, uint16_t len,
gpointer user_data)
{
@@ -1173,8 +1177,6 @@ failed:
void attrib_server_exit(void)
{
- GSList *l;
-
g_slist_free_full(database, attrib_free);
if (l2cap_io) {
@@ -1187,18 +1189,7 @@ void attrib_server_exit(void)
g_io_channel_shutdown(le_io, FALSE, NULL);
}
- for (l = clients; l; l = l->next) {
- struct gatt_channel *channel = l->data;
-
- g_slist_free(channel->notify);
- g_slist_free(channel->indicate);
- g_slist_free_full(channel->configs, attrib_free);
-
- g_attrib_unref(channel->attrib);
- g_free(channel);
- }
-
- g_slist_free(clients);
+ g_slist_free_full(clients, (GDestroyNotify) channel_free);
if (gatt_sdp_handle)
remove_record_from_server(gatt_sdp_handle);