[PATCH BlueZ v1 2/2] a2dp: Reject connection when the channel limit is exceeded

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

 



Reject incoming connection when the configured limit
for A2DP channels is exceeded.

Signed-off-by: Victor Pushkarev <VAnPushkarev@xxxxxxxxxxxxxxxxx>
---
 profiles/audio/a2dp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index b43161a13..117b27db3 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -2549,6 +2549,14 @@ static void confirm_cb(GIOChannel *io, gpointer data)
 	if (!chan)
 		goto drop;
 
+	if (btd_opts.a2dp.channels &&
+				queue_length(server->channels) > btd_opts.a2dp.channels) {
+		device_request_disconnect(device, NULL);
+		DBG("Reject current connection, A2DP channel limit exceeded: %d",
+						btd_opts.a2dp.channels);
+		goto drop;
+	}
+
 	chan->auth_id = btd_request_authorization(&src, &dst,
 							ADVANCED_AUDIO_UUID,
 							auth_cb, chan);
-- 
2.39.3 (Apple Git-145)





[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