Thread (11 messages) flat view 11 messages, 3 authors, 2021-02-18
STALE2041d

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

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2021-02-16 23:34:37
Subsystem: the rest · Maintainer: Linus Torvalds

From: Luiz Augusto von Dentz <redacted>

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help