- send = PARA_MIN(1024, len - written);
- ret = write(fd, buf + written, send);
- if (ret < 0)
- goto err_out;
+ size = PARA_MIN(1024, len - written);
+ ret = write(fd, buf + written, size);
+ if (ret < 0) {
+ if (errno != EAGAIN || retries++ > DCCP_WRITE_RETRIES)
+ goto err_out;
+ PARA_DEBUG_LOG("EAGAIN #%d@%zd/%zd\n", retries, written, len);
+ goto again;
+ }
+ retries = 0;