2015-10-02 05:18:58

by Jakub Pawlowski

[permalink] [raw]
Subject: [PATCH] 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(+)

diff --git a/src/device.c b/src/device.c
index 5ec8780..fd177f4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -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



2015-10-08 14:53:00

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] core/device: Fix disconnect for connect attempt

Hi Jakub,

On Wed, Oct 7, 2015 at 11:42 PM, Jakub Pawlowski <[email protected]> wrote:
> Ping ?
>
> On Thu, Oct 1, 2015 at 10:18 PM, Jakub Pawlowski <[email protected]> wrote:
>> 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(+)
>>
>> diff --git a/src/device.c b/src/device.c
>> index 5ec8780..fd177f4 100644
>> --- a/src/device.c
>> +++ b/src/device.c
>> @@ -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

Pushed, thanks.

--
Luiz Augusto von Dentz

2015-10-07 20:42:48

by Jakub Pawlowski

[permalink] [raw]
Subject: Re: [PATCH] core/device: Fix disconnect for connect attempt

Ping ?

On Thu, Oct 1, 2015 at 10:18 PM, Jakub Pawlowski <[email protected]> wrote:
> 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(+)
>
> diff --git a/src/device.c b/src/device.c
> index 5ec8780..fd177f4 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -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
>