[PATCH 2/2] device: reply to connect/disconnect requests on removal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replying here prevents the client from getting a DBus
NoReply when the device is removed.
---
 src/device.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index b8247cf..f42271c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -650,6 +650,7 @@ static void svc_dev_remove(gpointer user_data)
 static void device_free(gpointer user_data)
 {
 	struct btd_device *device = user_data;
+	DBusMessage *reply;
 
 	btd_gatt_client_destroy(device->client_dbus);
 	device->client_dbus = NULL;
@@ -677,11 +678,17 @@ static void device_free(gpointer user_data)
 	if (device->discov_timer)
 		g_source_remove(device->discov_timer);
 
-	if (device->connect)
+	if (device->connect) {
+		reply = btd_error_failed(device->connect, "Device removed");
+		g_dbus_send_message(dbus_conn, reply);
 		dbus_message_unref(device->connect);
+	}
 
-	if (device->disconnect)
+	if (device->disconnect) {
+		reply = btd_error_failed(device->disconnect, "Device removed");
+		g_dbus_send_message(dbus_conn, reply);
 		dbus_message_unref(device->disconnect);
+	}
 
 	DBG("%p", device);
 
-- 
2.7.4




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux