]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
HTSP: seems writer must deal with EAGAIN and EWOULDBLOCK
authorAndreas Öman <andreas@lonelycoder.com>
Mon, 19 Nov 2012 08:17:14 +0000 (09:17 +0100)
committerAndreas Öman <andreas@lonelycoder.com>
Mon, 19 Nov 2012 13:46:50 +0000 (14:46 +0100)
src/htsp_server.c

index ef49a7c4522c2494d28b276bfa2b700d7cb02499..dc17c199fd97da2c0a810e093ac783dd74a611be 100644 (file)
@@ -1705,12 +1705,17 @@ htsp_write_scheduler(void *aux)
 
     while(dlen > 0) {
       r = write(htsp->htsp_fd, dptr, dlen);
-      if(r < 1) {
+      if(r < 0) {
+        if(errno == EAGAIN || errno == EWOULDBLOCK)
+          continue;
         tvhlog(LOG_INFO, "htsp", "%s: Write error -- %s",
                htsp->htsp_logname, strerror(errno));
         break;
       }
-
+      if(r == 0) {
+        tvhlog(LOG_ERR, "htsp", "%s: write() returned 0",
+               htsp->htsp_logname);
+      }
       dptr += r;
       dlen -= r;
     }