linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] device: cancel connection request if browsing is cancelled
@ 2019-09-13 19:00 Scott Mertz
  0 siblings, 0 replies; only message in thread
From: Scott Mertz @ 2019-09-13 19:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Scott Mertz

If a dbus client calls Connect before service discovery is complete,
then attempts to cancel that by calling Disconnect, the original
Connect request would never be completed.

This fixes the bug by cancelling the Connect call upon cancelling
the browse request, which is done when Disconnect is called.
---
 src/device.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/device.c b/src/device.c
index 263f60a..b8247cf 100644
--- a/src/device.c
+++ b/src/device.c
@@ -626,6 +626,12 @@ static void browse_request_cancel(struct browse_req *req)
 
 	attio_cleanup(device);
 
+	if (req->msg && dbus_message_is_method_call(req->msg, DEVICE_INTERFACE,
+								"Connect")) {
+		DBusMessage *reply = btd_error_failed(req->msg, "Cancelled");
+		g_dbus_send_message(dbus_conn, reply);
+	}
+
 	browse_request_free(req);
 }
 
-- 
2.7.4


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

only message in thread, other threads:[~2019-09-13 19:00 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:00 [PATCH] device: cancel connection request if browsing is cancelled 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).