Loading lib/asyn-ares.c +7 −3 Original line number Diff line number Diff line Loading @@ -373,7 +373,6 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, /* Wait for the name resolve query to complete. */ while(!result) { struct timeval *tvp, tv, store; long timediff; int itimeout; int timeout_ms; Loading Loading @@ -402,8 +401,13 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, result = CURLE_ABORTED_BY_CALLBACK; else { struct timeval now2 = Curl_tvnow(); timediff = Curl_tvdiff(now2, now); /* spent time */ timeout -= timediff?timediff:1; /* always deduct at least 1 */ time_t timediff = Curl_tvdiff(now2, now); /* spent time */ if(timediff <= 0) timeout -= 1; /* always deduct at least 1 */ else if(timediff > timeout) timeout = -1; else timeout -= (long)timediff; now = now2; /* for next loop */ } if(timeout < 0) Loading lib/easy.c +9 −3 Original line number Diff line number Diff line Loading @@ -615,12 +615,18 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev) } } if(!ev->msbump) if(!ev->msbump) { /* If nothing updated the timeout, we decrease it by the spent time. * If it was updated, it has the new timeout time stored already. */ ev->ms += (long)curlx_tvdiff(after, before); time_t timediff = curlx_tvdiff(after, before); if(timediff > 0) { if(timediff > ev->ms) ev->ms = 0; else ev->ms -= (long)timediff; } } } else return CURLE_RECV_ERROR; Loading lib/hostip.c +4 −3 Original line number Diff line number Diff line Loading @@ -596,7 +596,7 @@ int Curl_resolv_timeout(struct connectdata *conn, /* Ignore the timeout when signals are disabled */ timeout = 0; else timeout = timeoutms; timeout = (timeoutms > LONG_MAX) ? LONG_MAX : (long)timeoutms; if(!timeout) /* USE_ALARM_TIMEOUT defined, but no timeout actually requested */ Loading Loading @@ -688,10 +688,11 @@ clean_up: the time we spent until now! */ if(prev_alarm) { /* there was an alarm() set before us, now put it back */ unsigned long elapsed_ms = Curl_tvdiff(Curl_tvnow(), conn->created); unsigned long elapsed_secs = (unsigned long) (Curl_tvdiff(Curl_tvnow(), conn->created) / 1000); /* the alarm period is counted in even number of seconds */ unsigned long alarm_set = prev_alarm - elapsed_ms/1000; unsigned long alarm_set = prev_alarm - elapsed_secs; if(!alarm_set || ((alarm_set >= 0x80000000) && (prev_alarm < 0x80000000)) ) { Loading lib/timeval.c +0 −6 Original line number Diff line number Diff line Loading @@ -141,9 +141,3 @@ double curlx_tvdiff_secs(struct timeval newer, struct timeval older) (double)(newer.tv_usec-older.tv_usec)/1000000.0; return (double)(newer.tv_usec-older.tv_usec)/1000000.0; } /* return the number of seconds in the given input timeval struct */ time_t Curl_tvlong(struct timeval t1) { return t1.tv_sec; } lib/timeval.h +0 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,6 @@ time_t curlx_tvdiff(struct timeval t1, struct timeval t2); */ double curlx_tvdiff_secs(struct timeval t1, struct timeval t2); time_t Curl_tvlong(struct timeval t1); /* These two defines below exist to provide the older API for library internals only. */ #define Curl_tvnow() curlx_tvnow() Loading Loading
lib/asyn-ares.c +7 −3 Original line number Diff line number Diff line Loading @@ -373,7 +373,6 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, /* Wait for the name resolve query to complete. */ while(!result) { struct timeval *tvp, tv, store; long timediff; int itimeout; int timeout_ms; Loading Loading @@ -402,8 +401,13 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, result = CURLE_ABORTED_BY_CALLBACK; else { struct timeval now2 = Curl_tvnow(); timediff = Curl_tvdiff(now2, now); /* spent time */ timeout -= timediff?timediff:1; /* always deduct at least 1 */ time_t timediff = Curl_tvdiff(now2, now); /* spent time */ if(timediff <= 0) timeout -= 1; /* always deduct at least 1 */ else if(timediff > timeout) timeout = -1; else timeout -= (long)timediff; now = now2; /* for next loop */ } if(timeout < 0) Loading
lib/easy.c +9 −3 Original line number Diff line number Diff line Loading @@ -615,12 +615,18 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev) } } if(!ev->msbump) if(!ev->msbump) { /* If nothing updated the timeout, we decrease it by the spent time. * If it was updated, it has the new timeout time stored already. */ ev->ms += (long)curlx_tvdiff(after, before); time_t timediff = curlx_tvdiff(after, before); if(timediff > 0) { if(timediff > ev->ms) ev->ms = 0; else ev->ms -= (long)timediff; } } } else return CURLE_RECV_ERROR; Loading
lib/hostip.c +4 −3 Original line number Diff line number Diff line Loading @@ -596,7 +596,7 @@ int Curl_resolv_timeout(struct connectdata *conn, /* Ignore the timeout when signals are disabled */ timeout = 0; else timeout = timeoutms; timeout = (timeoutms > LONG_MAX) ? LONG_MAX : (long)timeoutms; if(!timeout) /* USE_ALARM_TIMEOUT defined, but no timeout actually requested */ Loading Loading @@ -688,10 +688,11 @@ clean_up: the time we spent until now! */ if(prev_alarm) { /* there was an alarm() set before us, now put it back */ unsigned long elapsed_ms = Curl_tvdiff(Curl_tvnow(), conn->created); unsigned long elapsed_secs = (unsigned long) (Curl_tvdiff(Curl_tvnow(), conn->created) / 1000); /* the alarm period is counted in even number of seconds */ unsigned long alarm_set = prev_alarm - elapsed_ms/1000; unsigned long alarm_set = prev_alarm - elapsed_secs; if(!alarm_set || ((alarm_set >= 0x80000000) && (prev_alarm < 0x80000000)) ) { Loading
lib/timeval.c +0 −6 Original line number Diff line number Diff line Loading @@ -141,9 +141,3 @@ double curlx_tvdiff_secs(struct timeval newer, struct timeval older) (double)(newer.tv_usec-older.tv_usec)/1000000.0; return (double)(newer.tv_usec-older.tv_usec)/1000000.0; } /* return the number of seconds in the given input timeval struct */ time_t Curl_tvlong(struct timeval t1) { return t1.tv_sec; }
lib/timeval.h +0 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,6 @@ time_t curlx_tvdiff(struct timeval t1, struct timeval t2); */ double curlx_tvdiff_secs(struct timeval t1, struct timeval t2); time_t Curl_tvlong(struct timeval t1); /* These two defines below exist to provide the older API for library internals only. */ #define Curl_tvnow() curlx_tvnow() Loading