linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] device: reply to connect/disconnect requests on removal
@ 2019-09-13 19:03 Scott Mertz
  0 siblings, 0 replies; only message in thread
From: Scott Mertz @ 2019-09-13 19:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Scott Mertz

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-13 19:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 19:03 [PATCH 2/2] device: reply to connect/disconnect requests on removal Scott Mertz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).