cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to close established by libcurl FTP connections

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 6 Aug 2007 08:49:44 +0200 (CEST)

On Mon, 6 Aug 2007, Robert Iakobashvili wrote:

>> Remove an easy handle from a multi handle would certainly not be right
>> either, I would say. And there as well, the connection is owned by the
>> multi handle and not by the individual easy handle after a completed
>> transfer.
>>
>> So, I guess we simply need to introduce a way to do it!
>
> A guess, that the ball is now on my side, which will require some moons to
> pass till my expected future free time-slots. :)

Haha, well I do seem to recall that the world is habitated by a few other
souls than just you and me, so there are at least a few other possibilities...

We can start with outlining how it should be done, as then implementing the
function will be easier for whoever does it.

As I see it, the problem for a generic API for both the easy interface and the
multi interface is that the connection is not "owned" by the easy interface in
the latter case, and when you've detached an easy interface from the multi
handle it's not even possible to know what multi handle that used to host it
either.

So, do you have any suggested proto or API how this should/could be done by an
application?

> What is even worse, that setting the bit of FRESH_CONNECT for a handle busy
> with a FTP does open fresh FTP connections (data and control), but without
> closing old connections.

Well, libcurl is rather agressively trying to maintain persistent connections
so it doesn't close any connection unless told so (unless it runs the
connection cache full), and you (effectively) tell it to close by using
CURLOPT_FORBID_REUSE - but that is of course set _before_ a transfer is made.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-08-06