From c8bbae5047286450b5692dc8c5d2aa9825229aee Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 9 Nov 2018 20:10:17 +0100 Subject: [PATCH] satip: rtp - improve udp_multisend_send() error / full buffer condition checking, fixes #5319 --- src/satip/rtp.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/satip/rtp.c b/src/satip/rtp.c index dd334b4a7..a15cf240b 100644 --- a/src/satip/rtp.c +++ b/src/satip/rtp.c @@ -177,9 +177,24 @@ satip_rtp_send(satip_rtp_session_t *rtp) packets++; copy = 0; } - r = udp_multisend_send(&rtp->um, rtp->fd_rtp, packets); - if (r < 0) - return r; + while (1) { + r = udp_multisend_send(&rtp->um, rtp->fd_rtp, packets); + if (r < 0) { + if (errno == EINTR) + continue; + if (errno == EAGAIN || errno == EWOULDBLOCK) { + tvh_usleep(100); + continue; + } + tvhtrace(LS_SATIPS, "rtp udp multisend failed (errno %d)", errno); + return r; + } + break; + } + if (r != packets) { + tvhtrace(LS_SATIPS, "rtp udp multisend failed (packets %d written %d)", packets, r); + return -1; + } if (copy) memcpy(v->iov_base, v2->iov_base, len = v2->iov_len); else -- 2.47.2