All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: "João Paulo Rechi Vita" <jprvita@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ v3 06/14] core: mutually exclude concurrent connections
Date: Fri, 17 Aug 2012 10:51:17 +0300	[thread overview]
Message-ID: <20120817075117.GC30060@x220> (raw)
In-Reply-To: <1345152524-13404-7-git-send-email-jprvita@openbossa.org>

Hi,

On Thu, Aug 16, 2012, João Paulo Rechi Vita wrote:
> @@ -133,8 +133,10 @@ struct btd_adapter {
> +	GSList *connecting_list;	/* Pending connects */
> +	gboolean connecting;		/* Connect active */

What's the relationship with the above two? Isn't connecting always true
when g_slist_length(connecting_list) > 0 and false when the list is
empty?

>  static gboolean connect_pending_cb(gpointer user_data)
>  {
>  	struct btd_device *device = user_data;
>  	struct btd_adapter *adapter = device_get_adapter(device);
> +	GIOChannel *io;
>  
>  	/* in the future we may want to check here if the controller supports
>  	 * scanning and connecting at the same time */
>  	if (adapter->discovering)
>  		return TRUE;
>  
> -	device_att_connect(device);
> +	if (adapter->connecting)
> +		return TRUE;
> +
> +	adapter->connecting = TRUE;
> +	io = device_att_connect(device);
> +	g_io_add_watch(io, G_IO_OUT | G_IO_ERR, clean_connecting_state,
> +						btd_device_ref(device));
>  
>  	return FALSE;
>  }

Since you're not storing "io" after the function returns you should be
doing a g_io_channel_unref() after calling g_io_add_watch(). Looking at
device_att_connect it seems like it's missing a g_io_channel_ref (either
when assigning to device->att_io or when returning from the function).

> +		adapter->connecting_list = g_slist_append(
> +					adapter->connecting_list, device);
>  

Missing btd_device_unref()?

Johan

  reply	other threads:[~2012-08-17  7:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16 21:28 [PATCH BlueZ v3 00/14] LE General Connection Establishment procedure João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 01/14] core: Control connections based on adapter state João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 02/14] mgmt: print error message when start_discovery fails João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 03/14] core: add compare function for bdaddr in a struct btd_device João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 04/14] core: Add a list of LE devices to connect João Paulo Rechi Vita
2012-08-17  7:42   ` Johan Hedberg
2012-08-16 21:28 ` [PATCH BlueZ v3 05/14] core: use adapter connect list for LE connections João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 06/14] core: mutually exclude concurrent connections João Paulo Rechi Vita
2012-08-17  7:51   ` Johan Hedberg [this message]
2012-08-30 22:08     ` Joao Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 07/14] mgmt: Add LE scanning callback João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 08/14] core: Replace interleaved by LE scanning João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 09/14] core: Start LE scanning when a device requests João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 10/14] core: Remove leftover define João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 11/14] core: Queue discovery if scanning is active João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 12/14] test: Fix exiting the bus when a discovery session ends João Paulo Rechi Vita
2012-08-16 21:28 ` [PATCH BlueZ v3 13/14] core: Disable unnecessary auto connections João Paulo Rechi Vita
2012-08-17  7:39   ` Johan Hedberg
2012-08-16 21:28 ` [PATCH BlueZ v3 14/14] core: Re-connect for ECONNRESET or ECONNABORTED João Paulo Rechi Vita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120817075117.GC30060@x220 \
    --to=johan.hedberg@gmail.com \
    --cc=jprvita@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.