From ead0f1cae43396b1ab5152b63dfaa8ffcad13cb1 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 18 Aug 2015 13:51:39 +1000 Subject: [PATCH] Allow timeout to reach zero in read_socket_line for one non-blocking read --- src/ckpool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 1748c522..faf9fd7d 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -536,7 +536,7 @@ int read_socket_line(connsock_t *cs, float *timeout) tv_time(&start); rewait: - if (*timeout <= 0) { + if (*timeout < 0) { LOGDEBUG("Timed out in read_socket_line"); ret = 0; goto out; @@ -569,7 +569,7 @@ rewait: if (eom) break; /* Have we used up all the timeout yet? */ - if (*timeout > 0 && (errno == EAGAIN || errno == EWOULDBLOCK || !ret)) + if (*timeout >= 0 && (errno == EAGAIN || errno == EWOULDBLOCK || !ret)) goto rewait; if (cs->ckp->proxy) LOGINFO("Failed to recv in read_socket_line");