cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Clear connection cache libcurl 7.44

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 5 Jul 2016 17:35:42 -0400

On 7/5/2016 9:19 AM, risto via curl-library wrote:
> What are the possible ways to clear cURL connection cache? One way
> would be to close the current multi handle and open a new one. Are
> there some other options? I've got a situation where connection cache
> is kept through internet connection change (Wifi -> 3G for example).
> After network change cURL will try to reuse the connection from cache
> and will fail and open a new connection. The problem is that it takes
> ~20 seconds to understand that the connection was dead. Are there any
> ways to overcome this? I'd still like to reuse connections when
> possible. I could force requests with CURLOPT_FRESH_CONNECT after
> network change for some time but that's not ideal.

As far as I know there's no way to clear the connection cache. You could
change handles as you mentioned.

If the connection dies libcurl opens a new one as your output shows. I
don't think there's anything it can do about this if recv does not error
for 20 seconds and you don't want to disable connection reuse.
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-07-05