HTSP: seems writer must deal with EAGAIN and EWOULDBLOCK

This commit is contained in:
Andreas Öman 2012-11-19 09:17:14 +01:00
parent 70f0801c9b
commit be20dd6488

View 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;
}