From 73d7252f24a40582dc204f69b02aed295b15d380 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 18 Mar 2023 13:43:41 +0200 Subject: [PATCH] bluez5: use nonblocking i/o for SCO Although SCO sockets usually don't block, they could, so do nonblocking reads/writes. --- spa/plugins/bluez5/sco-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/plugins/bluez5/sco-io.c b/spa/plugins/bluez5/sco-io.c index 70b9e87bf..cb72953d8 100644 --- a/spa/plugins/bluez5/sco-io.c +++ b/spa/plugins/bluez5/sco-io.c @@ -89,7 +89,7 @@ static void sco_io_on_ready(struct spa_source *source) int res; read_again: - res = read(io->fd, io->read_buffer, SPA_MIN(io->read_mtu, MAX_MTU)); + res = recv(io->fd, io->read_buffer, SPA_MIN(io->read_mtu, MAX_MTU), MSG_DONTWAIT); if (res <= 0) { if (errno == EINTR) { /* retry if interrupted */ @@ -165,7 +165,7 @@ int spa_bt_sco_io_write(struct spa_bt_sco_io *io, uint8_t *buf, int size) do { int written; - written = write(io->fd, buf, packet_size); + written = send(io->fd, buf, packet_size, MSG_DONTWAIT | MSG_NOSIGNAL); if (written < 0) { if (errno == EINTR) { /* retry if interrupted */