From 7ece89b0b6f1ef8b4d4ca132a5163c08a14c41e2 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 8 Nov 2017 15:55:48 +0200 Subject: [PATCH] avdtp: Fix not disconnecting avdtp_unref would actually wait 1 second before disconnecting which may be enough for the remote device to start a new stream when it should not be able to that anymore. --- profiles/audio/avdtp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 004bf6514..a7caccb9f 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -1154,9 +1154,12 @@ static void set_disconnect_timer(struct avdtp *session) if (session->dc_timer) remove_disconnect_timer(session); - session->dc_timer = g_timeout_add_seconds(DISCONNECT_TIMEOUT, - disconnect_timeout, - session); + if (!session->stream_setup) + session->dc_timer = g_idle_add(disconnect_timeout, session); + else + session->dc_timer = g_timeout_add_seconds(DISCONNECT_TIMEOUT, + disconnect_timeout, + session); } void avdtp_unref(struct avdtp *session) -- 2.47.3