cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Clear connection cache libcurl 7.44

From: Frank Meier <frank.meier_at_ergon.ch>
Date: Mon, 11 Jul 2016 09:17:05 +0200

I also would be interested in a feature to manage the connection cache.
My use-case is a bit different though. I like to cleanup connections
which have already been closed from the server side. This "half-open"
connections stay in the state "CLOSE_WAIT" (seen with netstat) and are
only released after a further request is performed with the same
multi_handle. At the moment we achieve this cleanup by performing some
"dummy" requests if there are no "real" requests to be performed.

So if there would be an API to close specific (or all) connections in
the connection cache please also consider a functionality to just close
the ones in CLOSE_WAIT state.

Maybe the command could look something like:

curl_multi_conn_cache_cleanup(CURLM *multi_handle, struct curl_slist
*conn_list_to_remove)

whereas an empty list only cleans "dead" connections. The format of the
list would be something like "src_ip:src_port:dst_ip:dst_port, ...."
whereas omitted elements would act as wildcard. So a list entry "::::"
would close all connections in the cache.

cheers, Frank

On 06/07/16 22:12, Daniel Stenberg wrote:
> On Tue, 5 Jul 2016, risto via curl-library wrote:
>
>> 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?
>
> As Ray explained already, we don't offer any way to flush or reset the
> connection pool today. What would your suggested approach be if you
> got to wish for how it would work?
>

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-07-11