]> git.tue.mpg.de Git - paraslash.git/commitdiff
dccp_send: Retry on EAGAIN
authorAndre <maan@p133.(none)>
Fri, 7 Jul 2006 15:28:21 +0000 (17:28 +0200)
committerAndre <maan@p133.(none)>
Fri, 7 Jul 2006 15:28:21 +0000 (17:28 +0200)
Not nice, but fixes oggvorbis over dccp.

dccp_send.c

index aba21a6db1d2e92aa997a964a053d8000df9b2f1..3592a2827a70b2441bc51a1bd6cbe7e1181d7374 100644 (file)
@@ -120,15 +120,22 @@ static void dccp_shutdown_client(struct dccp_client *dc)
        free(dc);
 }
 
+#define DCCP_RETRIES 100
+
 static int dccp_write(int fd, const char *buf, size_t len)
 {
        size_t size, written = 0;
-       int ret;
+       int ret, retries = 0;
 again:
        size = PARA_MIN(1024, len - written);
        ret = write(fd, buf + written, size);
-       if (ret < 0)
-               goto err_out;
+       if (ret < 0) {
+               if (errno != EAGAIN || !retries++ > DCCP_RETRIES)
+                       goto err_out;
+               PARA_DEBUG_LOG("EAGAIN #%d@%d/%d\n", retries, written, len);
+               goto again;
+       }
+       retries = 0;
        written += ret;
        if (written >= len)
                return written;