Skip to contentSkip to conversation

core/device: Fix disconnect for connect attempt

PATCH In review Jakub Pawlowski 2 participants 3 messages Oct 2, 2015 – Oct 8, 2015 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 core/device: Fix disconnect for connect attempt

Right now calling Disconnect from DBus on device that's not advertising or out of sight will not stop the connect attempt in kernel. This patch fixes that by making sure that att_io is properly cleaned up on disconnect.

---
 src/device.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/device.c +6 -0
index 5ec8780..fd177f4 100644
@@ -1355,6 +1355,12 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
 	if (device->browse)
 		browse_request_cancel(device->browse);
 
+	if (device->att_io) {
+		g_io_channel_shutdown(device->att_io, FALSE, NULL);
+		g_io_channel_unref(device->att_io);
+		device->att_io = NULL;
+	}
+
 	if (device->connect) {
 		DBusMessage *reply = btd_error_failed(device->connect,
 								"Cancelled");
Signature · 1 line
2.5.0
#1 lore raw

Ping ?

Quoted 28 lines · Jakub Pawlowski

Right now calling Disconnect from DBus on device that's not advertising or out of sight will not stop the connect attempt in kernel. This patch fixes that by making sure that att_io is properly cleaned up on disconnect.

---
 src/device.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/device.c +6 -1
index 5ec8780..fd177f4 100644
@@ -1355,6 +1355,12 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
        if (device->browse)
                browse_request_cancel(device->browse);
 
+       if (device->att_io) {
+               g_io_channel_shutdown(device->att_io, FALSE, NULL);
+               g_io_channel_unref(device->att_io);
+               device->att_io = NULL;
+       }
+
        if (device->connect) {
                DBusMessage *reply = btd_error_failed(device->connect,
                                                                "Cancelled");
--

2.5.0

#2 lore raw

Hi Jakub,

Quoted 19 lines · Jakub Pawlowski

Ping ?

Quoted 16 lines · Jakub Pawlowski

Right now calling Disconnect from DBus on device that's not advertising or out of sight will not stop the connect attempt in kernel. This patch fixes that by making sure that att_io is properly cleaned up on disconnect.

---
 src/device.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/device.c +0 -0
index 5ec8780..fd177f4 100644
@@ -1355,6 +1355,12 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
        if (device->browse)
                browse_request_cancel(device->browse);
 
Quoted 11 lines
Quoted 11 lines
src/device.c +6 -1
+       if (device->att_io) {
+               g_io_channel_shutdown(device->att_io, FALSE, NULL);
+               g_io_channel_unref(device->att_io);
+               device->att_io = NULL;
+       }
+
        if (device->connect) {
                DBusMessage *reply = btd_error_failed(device->connect,
                                                                "Cancelled");
--

2.5.0

Pushed, thanks.

Signature · 1 line
Luiz Augusto von Dentz