On Sat, 4 May 2013, Marc Hoersken wrote:

I have no clue why there is a need for something like a closure_handle. Why can't the connection be freed with it's original handle? Daniel, can you elaborate on this one?

Sure. This is necessary because we do have connections that are independent of easy handles. If we perform a number of requests using a multi handle with one or more easy handles, and then remove all the easy handles from it again, the connections are left in the connection cache within the multi handle but with no easy handles present.

If you then for example close the multi handle, each of those connections need to be shut down properly. Proper shutting down some protocols involves some further communication, like a QUIT or a BYE command etc (such protocols are FTP, SMTP etc that have the PROTOPT_CLOSEACTION bit set in the flags field).

The libcurl internals are designed to always work with an easy handle together with a connection so we have an extra "closure_handle" around for when we need to shut down this kind of connection that no longer is associated with a "real" easy handle. An spare internal easy handle to do "closures" with!

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to