From: Johan Hedberg <johan.hedberg@gmail.com>
To: Arman Uguray <armansito@chromium.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v1 1/1] shared/att: Handle disconnects.
Date: Mon, 11 Aug 2014 10:24:09 +0300 [thread overview]
Message-ID: <20140811072409.GB21813@t440s> (raw)
In-Reply-To: <1407548769-5903-2-git-send-email-armansito@chromium.org>
Hi Arman,
On Fri, Aug 08, 2014, Arman Uguray wrote:
> +static bool disconnect_cb(struct io *io, void *user_data)
> +{
> + struct bt_att *att = user_data;
> +
> + bt_att_cancel_all(att);
> +
> + att->invalid = true;
> +
> + util_debug(att->debug_callback, att->debug_data,
> + "Physical link disconnected");
> +
> + if (att->disconn_callback)
> + att->disconn_callback(att->disconn_data);
> +
> + /* It's unsafe to destroy the struct io during the disconnect callback.
> + * post a task on the main loop to perform this later.
> + */
> + att->io_destroy_id = timeout_add(1, io_destroy_cb, att, NULL);
Is this the only reason you're keeping the "bool invalid" variable? I'd
take a different approach and fix the generic IO handling to be able to
destroy the io from within of the disconnect callback. The simplest way
to do this would be to increment the reference count in the generic io
code before calling the disconnect callback and the decrement once done
with the io pointer.
Johan
next prev parent reply other threads:[~2014-08-11 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-09 1:46 [PATCH v1 0/1] shared/att: Handle disconnects Arman Uguray
2014-08-09 1:46 ` [PATCH v1 1/1] " Arman Uguray
2014-08-11 7:24 ` Johan Hedberg [this message]
2014-08-11 21:21 ` Arman Uguray
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=20140811072409.GB21813@t440s \
--to=johan.hedberg@gmail.com \
--cc=armansito@chromium.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