diff options
author | Iulia Tanasescu <iulia.tanasescu@nxp.com> | 2023-09-07 18:12:27 +0300 |
---|---|---|
committer | Ayush Garg <ayush.garg@samsung.com> | 2024-01-05 19:04:04 +0530 |
commit | 7407b78014c178d1e65427dc1d3e19701a0c02e8 (patch) | |
tree | cc66f0c40d35b07ec4c676d01196c692bbf3e4ec | |
parent | 3c9c16b6e0f19313d81a1a42daad3d62766c296a (diff) | |
download | bluez-7407b78014c178d1e65427dc1d3e19701a0c02e8.tar.gz bluez-7407b78014c178d1e65427dc1d3e19701a0c02e8.tar.bz2 bluez-7407b78014c178d1e65427dc1d3e19701a0c02e8.zip |
btio: Add support for accepting BIS after defer setup
This adds btio support for accepting BIS connections when defer
setup is enabled on a Broadcast Receiver socket.
-rwxr-xr-x | btio/btio.c | 31 | ||||
-rwxr-xr-x | btio/btio.h | 4 |
2 files changed, 35 insertions, 0 deletions
diff --git a/btio/btio.c b/btio/btio.c index f500a232..b11a4e85 100755 --- a/btio/btio.c +++ b/btio/btio.c @@ -1789,6 +1789,37 @@ gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data, return TRUE; } +gboolean bt_io_bcast_accept(GIOChannel *io, BtIOConnect connect, + gpointer user_data, GDestroyNotify destroy, + GError * *err) +{ + int sock; + char c; + struct pollfd pfd; + + sock = g_io_channel_unix_get_fd(io); + + memset(&pfd, 0, sizeof(pfd)); + pfd.fd = sock; + pfd.events = POLLOUT; + + if (poll(&pfd, 1, 0) < 0) { + ERROR_FAILED(err, "poll", errno); + return FALSE; + } + + if (!(pfd.revents & POLLOUT)) { + if (read(sock, &c, 1) < 0) { + ERROR_FAILED(err, "read", errno); + return FALSE; + } + } + + server_add(io, connect, NULL, user_data, destroy); + + return TRUE; +} + gboolean bt_io_set(GIOChannel *io, GError **err, BtIOOption opt1, ...) { va_list args; diff --git a/btio/btio.h b/btio/btio.h index 642af2e2..3169bebf 100755 --- a/btio/btio.h +++ b/btio/btio.h @@ -75,6 +75,10 @@ typedef void (*BtIOConnect)(GIOChannel *io, GError *err, gpointer user_data); gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data, GDestroyNotify destroy, GError **err); +gboolean bt_io_bcast_accept(GIOChannel *io, BtIOConnect connect, + gpointer user_data, GDestroyNotify destroy, + GError **err); + gboolean bt_io_set(GIOChannel *io, GError **err, BtIOOption opt1, ...); gboolean bt_io_get(GIOChannel *io, GError **err, BtIOOption opt1, ...); |