Diff between 065bcf4b15d25a8bbc7b62654bb0ee2a38c1914a and 74595b14072b11466c2f75af9bfb0951a4689a56

Changed Files

File Additions Deletions Status
src/device.c +5 -5 modified
src/device.h +1 -1 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index 4113811..ea316b7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3116,7 +3116,7 @@ static void att_success_cb(gpointer user_data)
 	g_slist_foreach(device->attios, attio_connected, device->attrib);
 }
 
-GIOChannel *device_connect_le(struct btd_device *dev)
+int device_connect_le(struct btd_device *dev)
 {
 	struct btd_adapter *adapter = dev->adapter;
 	struct att_callbacks *attcb;
@@ -3127,7 +3127,7 @@ GIOChannel *device_connect_le(struct btd_device *dev)
 
 	/* There is one connection attempt going on */
 	if (dev->att_io)
-		return NULL;
+		return -EALREADY;
 
 	ba2str(&dev->bdaddr, addr);
 
@@ -3168,13 +3168,13 @@ GIOChannel *device_connect_le(struct btd_device *dev)
 		error("ATT bt_io_connect(%s): %s", addr, gerr->message);
 		g_error_free(gerr);
 		g_free(attcb);
-		return NULL;
+		return -EIO;
 	}
 
 	/* Keep this, so we can cancel the connection */
-	dev->att_io = g_io_channel_ref(io);
+	dev->att_io = io;
 
-	return io;
+	return 0;
 }
 
 static void att_browse_error_cb(const GError *gerr, gpointer user_data)
diff --git a/src/device.h b/src/device.h
index 696632c..102f21f 100644
--- a/src/device.h
+++ b/src/device.h
@@ -109,7 +109,7 @@ int device_unblock(struct btd_device *device, gboolean silent,
 void btd_device_set_pnpid(struct btd_device *device, uint16_t source,
 			uint16_t vendor, uint16_t product, uint16_t version);
 
-GIOChannel *device_connect_le(struct btd_device *dev);
+int device_connect_le(struct btd_device *dev);
 
 struct btd_profile;