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)