curl / Mailing Lists / curl-library / Single Mail

curl-library

RE: curl_easy_perform blocks when ifdown the ntwk interface

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 17 Nov 2018 11:54:08 +0100 (CET)

On Tue, 13 Nov 2018, Matthews, Jeremy via curl-library wrote:

> Well, curl_easy_perform did appear to block. When the interface was down,
> the function did not return, let alone return an error code.
>
> I have made this change:
>
> < curl_easy_setopt(mhCurl, CURLOPT_CONNECTTIMEOUT, f_lTimeoutSec);
> ---
>> curl_easy_setopt(mhCurl, CURLOPT_TIMEOUT, f_lTimeoutSec);
>
> ...and curl_easy_perform now returns and with the expected return code of 45
> (CURLE_INTERFACE_FAILED).

I'm not sure I understand your exact steps to reproduce this.

When do you take down the interface? The connect timeout is only applied to
the connection phase, so if curl first connects to a host and you *then* take
down the network, curl won't trigger any timeouts. You need another timeout
for that, like the CURLOPT_TIMEOUT you mention here.

If you take down the interface *before* you try to connect, then the connect
timeout should apply but then I also imagine that the connect attempt should
just fail hard even before the timeout can trigger.

(and please switch off digest mode for the mailing list when participating in
discussions, or at least remove all superfluous contents from mails)

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-11-17