summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-02-16 14:02:10 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-02-16 14:02:10 -0800
commitd13f06193cce07e2ad97070ad32e059d76cac4b7 (patch)
treee47dc2f8d424b6d91e7f584a726fc01bcbfd7332 /profiles
parent0c102742a8b4bc8d07545fd91d1a930885cc2867 (diff)
downloadbluez-d13f06193cce07e2ad97070ad32e059d76cac4b7.tar.gz
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.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/avdtp.c8
1 files changed, 7 insertions, 1 deletions
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);