diff options
-rw-r--r-- | lib/connect.c | 3 | ||||
-rw-r--r-- | lib/socks.c | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/connect.c b/lib/connect.c index 54c5f9e4c..421f90415 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -171,7 +171,8 @@ singleipconnect(struct connectdata *conn, /* * Curl_timeleft() returns the amount of milliseconds left allowed for the - * transfer/connection. If the value is negative, the timeout time has already + * transfer/connection. If the value is 0, there's no timeout (ie there's + * infinite time left). If the value is negative, the timeout time has already * elapsed. * * The start time is stored in progress.t_startsingle - as set with diff --git a/lib/socks.c b/lib/socks.c index 5dd83631c..dfd944ef3 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -62,15 +62,15 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */ int result; *n = 0; for(;;) { - timediff_t timeleft = Curl_timeleft(conn->data, NULL, TRUE); - if(timeleft < 0) { + timediff_t timeout_ms = Curl_timeleft(conn->data, NULL, TRUE); + if(timeout_ms < 0) { /* we already got the timeout */ result = CURLE_OPERATION_TIMEDOUT; break; } - if(timeleft > TIME_T_MAX) - timeleft = TIME_T_MAX; - if(SOCKET_READABLE(sockfd, (time_t)timeleft) <= 0) { + if(!timeout_ms || timeout_ms > TIME_T_MAX) + timeout_ms = TIME_T_MAX; + if(SOCKET_READABLE(sockfd, (time_t)timeout_ms) <= 0) { result = ~CURLE_OK; break; } |