cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: endless loop in Curl_wait_for_resolv (and fix?)

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 14 Apr 2004 13:32:19 +0200 (CEST)

On Wed, 14 Apr 2004, Dirk Manske wrote:

> sometimes ares resolvings hangs in Curl_wait_for_resolv. Moving 'now =
> Curl_tvnow();' infront of the loop fixed that behavior.
>
> Daniel, why do you have moved it into the loop in hostip.c 1.135?

Because the function wants to figure out how long time that has elapsed and
then deduct that time from the 'timeout' variable. If set 'now' before the
loop, we will detect more and more than was actually spent for every lap in
the loop.

The reason for this problem is of course that it often takes less than 1000ms
and since we count the timeout in full seconds, we often deduct zero from the
timeout value... To fix this, we should probably count the timeout time in
milliseconds in that loop.

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-14