From 64e74c71f8f68fc56f36ae4acb71bf96741dcc03 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 16 Jan 2016 23:15:07 +1100 Subject: [PATCH] Further simplify recv_available --- src/ckpool.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 5c156f0a..4f1bac06 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -554,7 +554,7 @@ static void add_buflen(connsock_t *cs, const char *readbuf, const int len) } /* Receive as much data is currently available without blocking into a connsock - * buffer. Returns length of read on success, -1 on failure */ + * buffer. Returns total length of data read. */ static int recv_available(connsock_t *cs) { char readbuf[PAGESIZE]; @@ -565,8 +565,7 @@ static int recv_available(connsock_t *cs) if (ret > 0) { add_buflen(cs, readbuf, ret); len += ret; - } else if (ret < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) - ret = 0; + } } while (ret > 0); return len; @@ -586,14 +585,8 @@ int read_socket_line(connsock_t *cs, float *timeout) int ret; clear_bufline(cs); - ret = recv_available(cs); + recv_available(cs); // Intentionally ignore return value eom = strchr(cs->buf, '\n'); - if (unlikely((ret == -1 || cs->fd == -1) && !eom)) { - if (proxy) - LOGINFO("Failed to receive data in read_socket_line"); - else - LOGERR("Failed to receive data in read_socket_line"); - } tv_time(&start);