On Thu, 23 Mar 2017, Deweloper wrote:

It should be. I wonder if it isn't also actually okay to reuse an easy handle, contrary to what the documentation says...

If I understand correctly, a "connection" is an entity specific to implementation of libcurl, inaccessible by API and outside of scope of application's interest.

Yes. Applications get to work with handles and each easy handle can be used for a transfer.

Does "taking over a connection" mean taking ownership of the socket obtained by calling curl_easy_getinfo(CURLINFO_ACTIVESOCKET), including the need to close() it?

Not with close, no, but with curl_easy_cleanup(). It means that your application has taken ownership of the connection and that libcurl won't do anything else with it and when you're done you shut down the handle like you use to.

I mean, won't libcurl never ever do any operation on the socket it returned to the application (especially closing it), apart when directed to do so by calling curl_easy_recv() or curl_easy_send()?

No. By asking CONNECT_ONLY, libcurl will not use the socket for anything else.

Now my app checks if curl_easy_recv or curl_easy_send returned something other than CURLE_OK and CURLE_AGAIN, or if curl_easy_recv returned zero length. In such cases it closes the socket provided earlier by CURLINFO_ACTIVESOCKET

The docs for CURLINFO_ACTIVESOCKET says that you should let libcurl close the socket.

then calls curl_multi_remove_handle, and some time later calls curl_multi_add_handle using the same easy handle. Does this make sense?

This part does! =)

--

 / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to