From bd379384451d725c0df547708c3a746599c9375a Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 2 Apr 2012 09:56:35 -0400 Subject: [PATCH] attrib: Fix missing Discovery reply when disconnected This patch fixes missing reply for DiscoverCharacteristics method on Generic Attribute. If link is disconnected reply message is not sent. --- attrib/client.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/attrib/client.c b/attrib/client.c index 9efcec94a..f1c26c468 100644 --- a/attrib/client.c +++ b/attrib/client.c @@ -357,6 +357,20 @@ static void attio_disconnected(gpointer user_data) { struct gatt_service *gatt = user_data; + if (gatt->query && gatt->query->msg) { + DBusMessage *reply; + + reply = btd_error_failed(gatt->query->msg, + "ATT IO channel was disconnected"); + g_dbus_send_message(gatt->conn, reply); + dbus_message_unref(gatt->query->msg); + } + + if (gatt->query) { + g_slist_free_full(gatt->query->list, g_free); + gatt->query = NULL; + } + if (gatt->attrib) { g_attrib_unref(gatt->attrib); gatt->attrib = NULL; -- 2.47.3