All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claudio Takahasi <claudio.takahasi@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Claudio Takahasi <claudio.takahasi@openbossa.org>
Subject: [PATCH BlueZ 4/4] Minor cleanup in attrib server channel disconnect
Date: Tue,  4 Oct 2011 14:52:23 -0300	[thread overview]
Message-ID: <1317750743-22632-1-git-send-email-claudio.takahasi@openbossa.org> (raw)
In-Reply-To: <1316438402-9982-4-git-send-email-claudio.takahasi@openbossa.org>

---
 src/attrib-server.c |   29 ++++++++++-------------------
 1 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index 5a50ade..95efd9f 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);
-- 
1.7.7


  reply	other threads:[~2011-10-04 17:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 13:19 [PATCH BlueZ 1/4] Attrib server integration for outgoing connections Claudio Takahasi
2011-09-19 13:20 ` [PATCH BlueZ 2/4] Fix the attrib server trying to handle responses Claudio Takahasi
2011-09-19 13:20 ` [PATCH BlueZ 3/4] Add attrib server channel detach Claudio Takahasi
2011-10-04 17:48   ` Claudio Takahasi
2011-10-04 17:50     ` Claudio Takahasi
2011-10-05  8:19       ` Johan Hedberg
2011-09-19 13:20 ` [PATCH BlueZ 4/4] Minor cleanup in attrib server channel disconnect Claudio Takahasi
2011-10-04 17:52   ` Claudio Takahasi [this message]
2011-09-27  9:29 ` [PATCH BlueZ 1/4] Attrib server integration for outgoing connections Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317750743-22632-1-git-send-email-claudio.takahasi@openbossa.org \
    --to=claudio.takahasi@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.