Diff between cfeaa68713d0fdbce59559b296753298d26dd09b and fba79d573c21aba871a5ce337cd98e0f1b7b448f

Changed Files

File Additions Deletions Status
src/device.c +12 -0 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index 7a6f764..65838f5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4981,6 +4981,7 @@ static void search_cb(sdp_list_t *recs, int err, gpointer user_data)
 {
 	struct browse_req *req = user_data;
 	struct btd_device *device = req->device;
+	DBusMessage *reply;
 	GSList *primaries;
 	char addr[18];
 
@@ -5024,6 +5025,17 @@ static void search_cb(sdp_list_t *recs, int err, gpointer user_data)
 						DEVICE_INTERFACE, "UUIDs");
 
 send_reply:
+	/* If SDP search failed during an ongoing connection request, we should
+	 * reply to D-Bus method call.
+	 */
+	if (err < 0 && device->connect) {
+		DBG("SDP failed during connection");
+		reply = btd_error_failed(device->connect, strerror(-err));
+		g_dbus_send_message(dbus_conn, reply);
+		dbus_message_unref(device->connect);
+		device->connect = NULL;
+	}
+
 	device_svc_resolved(device, BROWSE_SDP, BDADDR_BREDR, err);
 }