cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_cleanup()

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 14 May 2004 08:39:49 +0200 (CEST)

On Thu, 13 May 2004, Joe Halpin wrote:

> The Guide says that curl_easy_cleanup() should only be called once. Is this
> "once" during the life of the program, once for each transfer, or something
> else?

Once for each curl handle. When you're doing using the easy handle, you call
curl_easy_cleanup() on it.

> I'm investigating a problem where ftp servers are emitting logs about
> connections timing out even though the client appears to be closing the
> connection properly. Personally I think they have a buggy server (it's a
> vxWorks machine and the server came with the OS), but I need to be sure that
> we're not doing something dumb.

When curl_easy_cleanup() is called while the connection to the server is still
alive (and believed to be sound), recent libcurl versions will send a QUIT to
the server before it disconnects...

> Basically, every 30 minutes our client ftp's a directory listing and then
> ftp's a file. The guy that wrote the code calls curl_easy_init(), gets a
> directory listing, and curl_easy_cleanup(). Then curl_easy_init(), transfers
> a file, followed by curl_easy_cleanup(). 30 minutes later the cycle repeats.
> Will this cause any problems?

No, that should work perfectly. The curl_easy_cleanup() calls will close the
connection to the server.

I agree that this sounds like a flaw in the server.

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-05-14