From be20dd6488f920798c2825f566952686a1713c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Mon, 19 Nov 2012 09:17:14 +0100 Subject: [PATCH] HTSP: seems writer must deal with EAGAIN and EWOULDBLOCK --- src/htsp_server.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/htsp_server.c b/src/htsp_server.c index ef49a7c4..dc17c199 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -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; }