[PATCH BlueZ v2] shared/bap: reset local ep state on stream detach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When removing streams in bt_bap_detach(), they are detached directly
without going through normal state transitions.  As BAP Unicast Server,
this leaves local endpoints to the state they were in, so they persist
if client connects again.  This is not wanted.

For server streams, clear the local ASE state on detach.  At that point,
the ASE is either already idle or the session is detached.

Don't modify state of remote endpoints (BAP Client streams), as only
remote server should do that.
---

Notes:
    v2:
    - clear endpoint in bap_ucast_detach(), for BAP Server only

 src/shared/bap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index c0f0c4f3c..9b7395223 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1357,6 +1357,12 @@ static void bap_ucast_detach(struct bt_bap_stream *stream)
 	bap_stream_clear_cfm(stream);
 
 	ep->stream = NULL;
+
+	if (!stream->client) {
+		ep->state = BT_ASCS_ASE_STATE_IDLE;
+		ep->old_state = BT_ASCS_ASE_STATE_IDLE;
+	}
+
 	bt_bap_stream_unref(stream);
 }
 
-- 
2.50.1





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux