cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi_cleanup closes easy handles ftp session even if easy handle has been removed from multi_handle

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 4 Apr 2007 15:32:58 +0200 (CEST)

On Wed, 4 Apr 2007, elupus wrote:

> After a transfer has completed, the easy_handle is removed from the
> multi_handle, and stored for later reuse, this works great for http
> connections. However for ftp it does not.
>
> The ftp sessions have a close action wich calls the ftp command QUIT. When
> the multi_handle is destroyed by multi_cleanup, this is called independent
> on if the easy_handle has been destroyed, thus closing the cached
> connection, and session needs to be reinited on next use of the easy handle.
>
> Is this by design, or just an overlook. Do i need to cache the multi_handle
> too to keep the connection cache?

This is by design, but there are ways we can add work-arounds for it or
perhaps you should consider writing your program differently.

Why do you cleanup the multi handle in the first places if you keep the easy
handle anyway?

The reason for this behaviour is anyway because the multi handle is what holds
the connection "cache" these days (since 7.16.0) and all the easy handles you
add to a multi handle all share that same connection cache. Thus, when you
kill the multi handle the shared cache must be destroyed and then the
connections must first be closed.

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