diff mbox series

[BlueZ,2/2] source: clean up outstanding AVDTP requests if the stream goes away.

Message ID 20241025202141.158946-2-daniel.beer@igorinstitute.com
State New
Headers show
Series None | expand

Commit Message

Daniel Beer Oct. 25, 2024, 8:21 p.m. UTC
If the stream goes IDLE while we have an outstanding request, connect_id
stays non-zero and is never cleared via a completion callback. As a
consequence, the profile on this device will never be connected
successfully again until BlueZ restarts.
---
 profiles/audio/source.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index 9fac352c8..db777e86d 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -134,6 +134,11 @@  static void stream_state_changed(struct avdtp_stream *stream,
 	case AVDTP_STATE_IDLE:
 		btd_service_disconnecting_complete(source->service, 0);
 
+		if (source->connect_id > 0) {
+			a2dp_cancel(source->connect_id);
+			source->connect_id = 0;
+		}
+
 		if (source->disconnect_id > 0) {
 			a2dp_cancel(source->disconnect_id);
 			source->disconnect_id = 0;