linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/3] avdtp: Fix setting disconnect timer when there is no local endpoints
@ 2021-02-16 23:33 Luiz Augusto von Dentz
  2021-02-16 23:33 ` [PATCH BlueZ 2/3] btio: Use G_PRIORITY_HIGH for watches Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2021-02-16 23:33 UTC (permalink / raw)
  To: linux-bluetooth

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(-)

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);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-18  1:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 23:33 [PATCH BlueZ 1/3] avdtp: Fix setting disconnect timer when there is no local endpoints Luiz Augusto von Dentz
2021-02-16 23:33 ` [PATCH BlueZ 2/3] btio: Use G_PRIORITY_HIGH for watches Luiz Augusto von Dentz
2021-02-16 23:33 ` [PATCH BlueZ 3/3] avdtp: Remove use of G_PRIORITY_LOW Luiz Augusto von Dentz
2021-02-17 20:24   ` Miao-chen Chou
2021-02-17 21:21     ` Luiz Augusto von Dentz
2021-02-17 21:41       ` Miao-chen Chou
2021-02-16 23:57 ` [BlueZ,1/3] avdtp: Fix setting disconnect timer when there is no local endpoints bluez.test.bot
2021-02-17 19:45   ` Luiz Augusto von Dentz
2021-02-17 20:37     ` Miao-chen Chou
2021-02-17 21:24       ` Luiz Augusto von Dentz
2021-02-18  1:28         ` Luiz Augusto von Dentz

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).