curl-library
Re: closing idle connections in multi conncache
Date: Tue, 17 Jun 2008 09:02:07 +0100
On Mon, 2008-06-16 at 23:48 +0200, Daniel Stenberg wrote:
> I think re-arranging code to not depend on conn->data isn't really a feasable
> idea, so instead we should probably try getting a SessionHandle to use for the
> disconnect. I'm thinking we can just make one for the close case, or possibly
> get one that is currently left added to the multi handle, and restore it back
> to the original state once all the idle connections are closed.
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?
> 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,
> I realize my comments took your "little hack" and turned it into a more
> advanced function that is no longer little, but I'm afraid I can't see how to
> implement it that small and yet fully and properly functional!
Heh. Well, I guess if it was that easy, someone would have done it
before.
p.
Received on 2008-06-17