Allow timeout to reach zero in read_socket_line for one non-blocking read

This commit is contained in:
Con Kolivas 2015-08-18 13:51:39 +10:00
parent b9f0c03d44
commit 137136648c

View File

@ -521,7 +521,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;
@ -550,7 +550,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;
LOGERR("Failed to recv in read_socket_line");
goto out;