Skip to contentSkip to conversation

device: cancel connection request if browsing is cancelled

PATCH New Scott Mertz 1 participant 1 message Sep 13, 2019 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device: cancel connection request if browsing is cancelled

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(+)
src/device.c +6 -0
index 263f60a..b8247cf 100644
@@ -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);
 }
 
Signature · 1 line
2.7.4