source: clean up outstanding AVDTP requests if the stream goes away
authorDaniel Beer <daniel.beer@igorinstitute.com>
Fri, 25 Oct 2024 20:21:41 +0000 (09:21 +1300)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 20 Feb 2025 07:43:24 +0000 (16:43 +0900)
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.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
profiles/audio/source.c

index 9fac352c88f15d80e36a74f3a649246e5ea6b1a5..db777e86d54209eb06eae782f0dd1221b632731a 100755 (executable)
@@ -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;