linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/3] audio/avdtp: Only set disconnect timer if connected
@ 2016-03-23 12:55 Luiz Augusto von Dentz
  2016-03-23 12:55 ` [PATCH BlueZ 2/3] audio/avdtp: Fix passing wrong error code Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-03-23 12:55 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If the session is not connected it makes no sense to enable the
disconnect timer.
---
 profiles/audio/avdtp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 52ee767..78e7b4d 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -1171,7 +1171,12 @@ void avdtp_unref(struct avdtp *session)
 	if (session->ref > 0)
 		return;
 
-	set_disconnect_timer(session);
+	if (session->state == AVDTP_SESSION_STATE_CONNECTED) {
+		set_disconnect_timer(session);
+		return;
+	}
+
+	connection_lost(session, ECONNABORTED);
 }
 
 struct avdtp *avdtp_ref(struct avdtp *session)
-- 
2.5.0


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

end of thread, other threads:[~2016-03-24 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-23 12:55 [PATCH BlueZ 1/3] audio/avdtp: Only set disconnect timer if connected Luiz Augusto von Dentz
2016-03-23 12:55 ` [PATCH BlueZ 2/3] audio/avdtp: Fix passing wrong error code Luiz Augusto von Dentz
2016-03-23 12:55 ` [PATCH BlueZ 3/3] audio/a2dp: Simplify error handling Luiz Augusto von Dentz
2016-03-24 13:52 ` [PATCH BlueZ 1/3] audio/avdtp: Only set disconnect timer if connected 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).