cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: about "-m" on windows systems

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 2 Feb 2004 22:06:03 +0100 (CET)

On Mon, 2 Feb 2004, Gisle Vanem wrote:

> I think someone is confused (me or you). -m/--max-timeout is for total
> transfer time and -c/--connect-timeout is for name resolution only AFAICS.
> If '-c', yes libcurl could fork off gethostbyname() in a separate thread and
> call WaitForSingleObject (.., timeout) on the thread handle. I did just this
> for Wget; look at function run_with_timeout() in mswindows.c.

-c is not the short option for --connect-timeout :-) -c is for --cookie-jar!

> The '-m' option could be done by emulating SIGALRM using 'timeSetEvent()'
> from winmm.lib (gettimeofday() already uses that if WITHOUT_MM_LIB isn't
> defined). But alarmfunc() cannot longjmp out of the event-callback.

Actually, both timeouts work fine and they only have the name resolve problem
you mention above (the -m timeout includes the connect timeout). I don't see
how you can solve this problem *failsafe* with an additional thread that kills
the first one on timeout. Won't there be a problem with left allocated
resources?

> I'm not sure how siglongjmp() is different from longjmp() in this respect,

It allows a longjmp out from a unix signal handler.

> but I wonder how this is safe to do in any environment. Not to mention it's
> not thread-safe to have only a single jmpbuf.

Indeed. And that's one of the reasons why we say CURLOPT_NOSIGNAL should be
set TRUE when using libcurl multi-threaded, as then it won't be used.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-02-02