cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl + libevent2: Stalling if no data is received/written

From: Dirk Manske <>
Date: Fri, 20 Aug 2010 19:22:13 +0200

On Friday 20 August 2010 18:37:55 Bas Verhoeven wrote:
> I'm kinda new in the curl world

> and have been fiddling with libcurl's
> 'multi' interface in combination with libevent a bit. I am mainly
> interested in this combination because my code already uses libevent2,
> yet I do not think the 'evhttp' code there is mature enough.
> I found an example that seemed to cover most of the functionality
> required to combine these two libraries:
> This code seems to work
> fine with the exception of one issue that I do not directly see a
> solution for: when connecting to a host that never responds libcurl
> never closes the connection/request.

> Is there any way I can force it to check for timeouts?

Simply set a time-out with curl_easy_setopt.

e.g. in hiperfifo.c insert
  curl_easy_setopt(conn->easy, CURLOPT_TIMEOUT, 5);
before line 344 and you'll get a nice working 5 second timeout.

But you need curl >=7.21.1 which fixed the famous bug 62.

In the old days you have to remove "stalled" easy handles manually
(e.g. add a time event, and when it's callback is triggered, then
this have to remove the easy handle from multi).

List admin:
Received on 2010-08-20