bluez5: use nonblocking i/o for SCO

Although SCO sockets usually don't block, they could, so do nonblocking
reads/writes.
This commit is contained in:
Pauli Virtanen 2023-03-18 13:43:41 +02:00
parent 13a9964a71
commit 73d7252f24

View file

@ -89,7 +89,7 @@ static void sco_io_on_ready(struct spa_source *source)
int res; int res;
read_again: 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 (res <= 0) {
if (errno == EINTR) { if (errno == EINTR) {
/* retry if interrupted */ /* 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 { do {
int written; int written;
written = write(io->fd, buf, packet_size); written = send(io->fd, buf, packet_size, MSG_DONTWAIT | MSG_NOSIGNAL);
if (written < 0) { if (written < 0) {
if (errno == EINTR) { if (errno == EINTR) {
/* retry if interrupted */ /* retry if interrupted */