cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: closing idle connections in multi conncache

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 18 Jun 2008 00:37:41 +0200 (CEST)

On Tue, 17 Jun 2008, Phil Blundell wrote:

> OK. Is it safe to just do something like:
>
> struct SessionHandle *data;
> Curl_open(&data);
> conn->data = data;
> Curl_disconnect(conn);
> Curl_close(data);
>
> or is there more to it than that?

I _think_ this will work but I think we need to do some tests and possibly
tweaks to know for real.

>> But the app is already calling curl_multi_perform() at the right moment for
>> the transfers, right? So it would only be a matter of make
>> curl_multi_timeout() return the correct time, and let curl_multi_perform()
>> do the checks and the closes when the time has come. Or did I
>> misunderstand?
>
> I think the only real issue here is that, again, Curl_expire() expects to be
> given a session handle and there isn't necessarily one available at this
> point. That said though it doesn't seem to actually hold on to the session
> handle itself, so I guess one could fake up a struct SessionHandle that just
> contained enough data for the timer system to work,

Oh right. So much within libcurl assumes and depends on a SessionHandle being
present. A lot of it quite possibly not really with a reason, but so far we
haven't had much motivation to clean it up properly.

This all taken into account, I think perhaps the separate close-idle function
isn't such a bad idea after all! ;-)

-- 
  / daniel.haxx.se
Received on 2008-06-18