diff mbox series

[BlueZ,1/3] avdtp: Fix setting disconnect timer when there is no local endpoints

Message ID 20210216233337.859955-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ,1/3] avdtp: Fix setting disconnect timer when there is no local endpoints | expand

Commit Message

Luiz Augusto von Dentz Feb. 16, 2021, 11:33 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If there are not local endpoints left there is no point in starting
the disconnect timer as without any endpoint it is not possible to
configure streams anymore so the code should proceed to disconnect
immediately.
---
 profiles/audio/avdtp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com Feb. 16, 2021, 11:57 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=434305

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz Feb. 17, 2021, 7:45 p.m. UTC | #2
Hi Miao,

On Tue, Feb 16, 2021 at 3:57 PM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=434305
>
> ---Test result---
>
> ##############################
> Test: CheckPatch - PASS
>
> ##############################
> Test: CheckGitLint - PASS
>
> ##############################
> Test: CheckBuild - PASS
>
> ##############################
> Test: MakeCheck - PASS
>
>
>
> ---
> Regards,
> Linux Bluetooth

Can you give this set a try with the use case you had? I tested with
unplugged use case and it now seems to trigger session_cb immediately
so it should work for your case as well.
Miao-chen Chou Feb. 17, 2021, 8:37 p.m. UTC | #3
Hi Luiz,

I was testing before seeing your email. Please take a look at my
comment on the last commit of the series.
Although this commit doesn't affect the symptom we observed (it was
IDLE state which triggers the disconnection of IO), the change makes
sense.

On Wed, Feb 17, 2021 at 11:45 AM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Miao,
>
> On Tue, Feb 16, 2021 at 3:57 PM <bluez.test.bot@gmail.com> wrote:
> >
> > This is automated email and please do not reply to this email!
> >
> > Dear submitter,
> >
> > Thank you for submitting the patches to the linux bluetooth mailing list.
> > This is a CI test results with your patch series:
> > PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=434305
> >
> > ---Test result---
> >
> > ##############################
> > Test: CheckPatch - PASS
> >
> > ##############################
> > Test: CheckGitLint - PASS
> >
> > ##############################
> > Test: CheckBuild - PASS
> >
> > ##############################
> > Test: MakeCheck - PASS
> >
> >
> >
> > ---
> > Regards,
> > Linux Bluetooth
>
> Can you give this set a try with the use case you had? I tested with
> unplugged use case and it now seems to trigger session_cb immediately
> so it should work for your case as well.
>
> --
> Luiz Augusto von Dentz
Thanks,
Miao
Luiz Augusto von Dentz Feb. 17, 2021, 9:24 p.m. UTC | #4
Hi Miao,

On Wed, Feb 17, 2021 at 12:37 PM Miao-chen Chou <mcchou@chromium.org> wrote:
>
> Hi Luiz,
>
> I was testing before seeing your email. Please take a look at my
> comment on the last commit of the series.
> Although this commit doesn't affect the symptom we observed (it was
> IDLE state which triggers the disconnection of IO), the change makes
> sense.

Yep, this doesn't actually make any difference on the matter of
freeing avdtp session when the adapter is removed but as you said it
makes sense on it own given that local endpoints can be unregistered.

> On Wed, Feb 17, 2021 at 11:45 AM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Miao,
> >
> > On Tue, Feb 16, 2021 at 3:57 PM <bluez.test.bot@gmail.com> wrote:
> > >
> > > This is automated email and please do not reply to this email!
> > >
> > > Dear submitter,
> > >
> > > Thank you for submitting the patches to the linux bluetooth mailing list.
> > > This is a CI test results with your patch series:
> > > PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=434305
> > >
> > > ---Test result---
> > >
> > > ##############################
> > > Test: CheckPatch - PASS
> > >
> > > ##############################
> > > Test: CheckGitLint - PASS
> > >
> > > ##############################
> > > Test: CheckBuild - PASS
> > >
> > > ##############################
> > > Test: MakeCheck - PASS
> > >
> > >
> > >
> > > ---
> > > Regards,
> > > Linux Bluetooth
> >
> > Can you give this set a try with the use case you had? I tested with
> > unplugged use case and it now seems to trigger session_cb immediately
> > so it should work for your case as well.
> >
> > --
> > Luiz Augusto von Dentz
> Thanks,
> Miao
Luiz Augusto von Dentz Feb. 18, 2021, 1:28 a.m. UTC | #5
Hi,

On Wed, Feb 17, 2021 at 1:24 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Miao,
>
> On Wed, Feb 17, 2021 at 12:37 PM Miao-chen Chou <mcchou@chromium.org> wrote:
> >
> > Hi Luiz,
> >
> > I was testing before seeing your email. Please take a look at my
> > comment on the last commit of the series.
> > Although this commit doesn't affect the symptom we observed (it was
> > IDLE state which triggers the disconnection of IO), the change makes
> > sense.
>
> Yep, this doesn't actually make any difference on the matter of
> freeing avdtp session when the adapter is removed but as you said it
> makes sense on it own given that local endpoints can be unregistered.
>
> > On Wed, Feb 17, 2021 at 11:45 AM Luiz Augusto von Dentz
> > <luiz.dentz@gmail.com> wrote:
> > >
> > > Hi Miao,
> > >
> > > On Tue, Feb 16, 2021 at 3:57 PM <bluez.test.bot@gmail.com> wrote:
> > > >
> > > > This is automated email and please do not reply to this email!
> > > >
> > > > Dear submitter,
> > > >
> > > > Thank you for submitting the patches to the linux bluetooth mailing list.
> > > > This is a CI test results with your patch series:
> > > > PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=434305
> > > >
> > > > ---Test result---
> > > >
> > > > ##############################
> > > > Test: CheckPatch - PASS
> > > >
> > > > ##############################
> > > > Test: CheckGitLint - PASS
> > > >
> > > > ##############################
> > > > Test: CheckBuild - PASS
> > > >
> > > > ##############################
> > > > Test: MakeCheck - PASS
> > > >
> > > >
> > > >
> > > > ---
> > > > Regards,
> > > > Linux Bluetooth
> > >
> > > Can you give this set a try with the use case you had? I tested with
> > > unplugged use case and it now seems to trigger session_cb immediately
> > > so it should work for your case as well.
> > >
> > > --
> > > Luiz Augusto von Dentz
> > Thanks,
> > Miao
>
>
>
> --
> Luiz Augusto von Dentz

Pushed.
diff mbox series

Patch

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index fa72ef66a..9ddcd6464 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -1226,7 +1226,13 @@  void avdtp_unref(struct avdtp *session)
 
 	switch (session->state) {
 	case AVDTP_SESSION_STATE_CONNECTED:
-		set_disconnect_timer(session);
+		/* Only set disconnect timer if there are local endpoints
+		 * otherwise disconnect immediately.
+		 */
+		if (queue_isempty(session->lseps))
+			connection_lost(session, ECONNRESET);
+		else
+			set_disconnect_timer(session);
 		break;
 	case AVDTP_SESSION_STATE_CONNECTING:
 		connection_lost(session, ECONNABORTED);