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 v8 1/8] core: Mutually exclude concurrent connections
Date: Tue, 2 Oct 2012 11:30:56 +0300 [thread overview]
Message-ID: <20121002083056.GB1969@x220> (raw)
In-Reply-To: <1349126651-749-1-git-send-email-jprvita@openbossa.org>
Hi,
On Mon, Oct 01, 2012, João Paulo Rechi Vita wrote:
> 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;
> + adapter->waiting_to_connect--;
> +
> + io = device_att_connect(device);
> + g_io_add_watch(io, G_IO_OUT | G_IO_ERR, clean_connecting_state,
> + btd_device_ref(device));
Looks like there is some error handling missing here since
device_att_connect could return NULL;
> + g_idle_add(connect_pending_cb, btd_device_ref(device));
Two spaces after the comma here. What's a bit worrying also is that you
don't store the idle id, but I suppose that's safe since you ensure that
this asynchronous operation has it's own reference to the device.
Johan
prev parent reply other threads:[~2012-10-02 8:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-01 21:24 [PATCH BlueZ v8 1/8] core: Mutually exclude concurrent connections João Paulo Rechi Vita
2012-10-01 21:24 ` [PATCH BlueZ v8 2/8] mgmt: Add LE scanning callback João Paulo Rechi Vita
2012-10-01 21:24 ` [PATCH BlueZ v8 3/8] core: Replace interleaved by LE scanning João Paulo Rechi Vita
2012-10-01 21:24 ` [PATCH BlueZ v8 4/8] core: Start LE scanning when a device requests João Paulo Rechi Vita
2012-10-01 21:24 ` [PATCH BlueZ v8 5/8] core: Disable unnecessary auto connections João Paulo Rechi Vita
2012-10-01 21:24 ` [PATCH BlueZ v8 6/8] core: Re-connect for ECONNRESET or ECONNABORTED João Paulo Rechi Vita
2012-10-01 21:24 ` [PATCH BlueZ v8 7/8] mgmt: Add address type to bonding debug message João Paulo Rechi Vita
2012-10-01 21:24 ` [PATCH BlueZ v8 8/8] core: Suspend scanning before connect on pairing João Paulo Rechi Vita
2012-10-02 8:30 ` Johan Hedberg [this message]
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=20121002083056.GB1969@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox