]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
satip: rtp - improve udp_multisend_send() error / full buffer condition checking... 1204/head
authorJaroslav Kysela <perex@perex.cz>
Fri, 9 Nov 2018 19:10:17 +0000 (20:10 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 9 Nov 2018 19:10:17 +0000 (20:10 +0100)
src/satip/rtp.c

index dd334b4a7e97fbda7c1cb127a5838a9532228b67..a15cf240b9250d8f0a7c3a69717ea3831d6ef6cd 100644 (file)
@@ -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