From 93b3d1fea00c4eb54ddae30c0909870c5c1b85ad Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 16 Feb 2021 14:02:10 -0800 Subject: [PATCH] avdtp: Fix setting disconnect timer when there is no local endpoints 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. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- 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 fcf1eb0..5f8ae66 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -1668,7 +1668,13 @@ void avdtp_unref(struct avdtp *session) else set_disconnect_timer(session); #else - 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); #endif break; case AVDTP_SESSION_STATE_CONNECTING: -- 2.7.4