cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Always get connection timeout

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 15 Aug 2008 13:51:53 -0700

On Fri, Aug 15, 2008 at 01:20:28PM -0700, Price, Robert wrote:
> The option for defining the timeout is:
> curl_easy_setopt(easyhandle,CURLOPT_CONNECTTIMEOUT,30);

This is wrong; it should be:

  curl_easy_setopt(easyhandle,CURLOPT_CONNECTTIMEOUT,30L);

You didn't say what architecture you're using, but if it's x86_64, this
will cause you grief (potentially the kind you're seeing).

> How, though, does that affect the calculation for Curl_timeleft()?

Because that value for CURLOPT_CONNECTTIMEOUT is used in Curl_timeleft().

> Because it doesn't even look at that. The initial value for timeout_ms
> = 30000, which is correct. The result I'm getting from Curl_timeleft()
> is ALWAYS 3532134. So, by subtracting that value from my timeout set, I
> end up with -3502134 - and it thinks I'm outta time.
>
> I've tried setting options to forbid reuse and force a fresh connect,
> but that doesn't seem to change anything. I'm beginning to wonder if I
> have some problem with Curl_tvnow() or something???

You could see what values are being returned by using gdb or adding some
debug prints in the code to try to narrow the problem.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-08-15