cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl + libevent2: Stalling if no data is received/written [new timeout patch]

From: Daniel Stenberg <>
Date: Sun, 29 Aug 2010 00:15:41 +0200 (CEST)

On Wed, 25 Aug 2010, Dirk Manske wrote:

> My patch fixes that. But indeed it's a bad patch. The operation timeout
> should be set only one time. But I'm not sure where the correct place is.

I found something interesting: we only ever call expire(0) from within
hostthre.c to kill a single timeout, the other three times we use the zero
argument we truly want to remove all existing timeouts.

So, if we just correct hostthre.c to not do that, we don't have to modify the
expire code at all - for now at least. I don't think it'll do us any harm if
we just remove the expire(0) calls from there but I didn't try it yet. And
that is only done with the threaded name resolver.

I just tried the multi-single example program with CURLOPT_TIMEOUT set against
a very slow URL, and it works as assumed with this simple patch applied. I'm
convinced this patch is correct no matter what, so I will commit and push this
in a second:

--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1433,6 +1433,12 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
    Curl_initinfo(data); /* reset session-specific information "variables" */

+ if(data->set.timeout)
+ Curl_expire(data, data->set.timeout);
+ if(data->set.connecttimeout)
+ Curl_expire(data, data->set.connecttimeout);
    return CURLE_OK;

List admin:
Received on 2010-08-29