linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archie Pusaka <apusaka@google.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth <linux-bluetooth@vger.kernel.org>
Subject: Re: [Bluez PATCH v1] input: disconnect intr channel before ctrl channel
Date: Wed, 18 Mar 2020 20:41:38 +0800	[thread overview]
Message-ID: <CAJQfnxELMMDa6nbxRUrW46VjEBj6Txfeym62PKi+R3iXHKU0CQ@mail.gmail.com> (raw)
In-Reply-To: <14E46BF4-0688-4A0B-AE84-46C4426C5E9A@holtmann.org>

> > I see, we shutdown the socket immediately since the socket API itself
> > don't seem to have a concept of disconnect syscall not sure if other
> > values could be passed to shutdown second parameter to indicate we
> > want to actually wait it to be disconnected.

I don't think the second parameter matters, I tried every possible
valid values and intr_watch_cb is still called without waiting for the
response.

>
> in a blocking synchronous system call world we have SO_LINGER for that. In the world of asynchronous IO handling (what we do), we need to check what is the right way of handling this.
>

I spot this piece of code [1] which utilizes getsockopt to query
socket connection information from the kernel space to the user space.
We can use a similar method to query whether (sk->sk_state ==
BT_CLOSED), which is only true when we get the response.
What do you think?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/net/bluetooth/l2cap_sock.c#n476

  reply	other threads:[~2020-03-18 12:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16  4:40 [Bluez PATCH v1] input: disconnect intr channel before ctrl channel Archie Pusaka
2020-03-16 20:57 ` Luiz Augusto von Dentz
2020-03-17  6:52   ` Archie Pusaka
2020-03-17 21:31     ` Luiz Augusto von Dentz
2020-03-18  5:24       ` Marcel Holtmann
2020-03-18 12:41         ` Archie Pusaka [this message]
2020-04-13 13:47           ` Archie Pusaka
2020-04-13 16:10             ` Luiz Augusto von Dentz

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=CAJQfnxELMMDa6nbxRUrW46VjEBj6Txfeym62PKi+R3iXHKU0CQ@mail.gmail.com \
    --to=apusaka@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.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;
as well as URLs for NNTP newsgroup(s).