cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-3112579 ] Premature timeout in Curl_wait_for_resolv

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sun, 05 Dec 2010 22:44:40 +0000

Bugs item #3112579, was opened at 2010-11-19 13:27
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3112579&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: wrong behaviour
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: NotGeneratedYet (lesch)
Assigned to: Daniel Stenberg (bagder)
Summary: Premature timeout in Curl_wait_for_resolv

Initial Comment:
File curl-7.21.2\lib\hostares.c function Curl_wait_for_resolv line 268

This function uses the timeout variable as remaining time.
Every round, timeout is decremented using time difference between waitperform() calls:
  timeout -= timediff?timediff:1;
  
But, timediff is calculated incorrectly. timediff is elapsed time not difference time:
  timediff = Curl_tvdiff(Curl_tvnow(), now); /* spent time */

So, the timeout variable may end much earlier than the real time.

Proposed solution:
Replace:
  timediff = Curl_tvdiff(Curl_tvnow(), now); /* spent time */
  timeout -= timediff?timediff:1; /* always deduct at least 1 */
By:
  struct timeval nowNew = Curl_tvnow();
  timediff = Curl_tvdiff(nowNew, now); /* difference between waitperform() calls */
  now = nowNew;
  timeout -= timediff?timediff:1; /* always deduct at least 1 */

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2010-12-05 23:44

Message:
Thanks for the report, this problem is now fixed in the git repository.

To try it out, you either checkout/update your git clone:
http://curl.haxx.se/source.html

or you try tomorrow's daily snapshot: http://curl.haxx.se/snapshots/

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3112579&group_id=976
Received on 2010-12-05

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET