I am using the curl multi interface with boost::asio, which cannot wait on sockets without taking ownership of them. For most sockets this is fine, since curl will create them via the CURLOPT_OPENSOCKETFUNCTION callback and close them with the CURLOPT_CLOSESOCKETFUNCTION callback, so asio can open and close them on its own. However, c-ares does not use those functions and instead opens and closes the sockets itself. This means that when curl passes the c-ares socket to the CURLMOPT_SOCKETFUNCTION it isn't owned by asio, and asio can't take ownership of the socket because c-ares will later close the socket. This means the program can't wait on data from that socket and so can't call curl_multi_socket_action at the right time.
I expected the following
Curl should use the OPEN/CLOSESOCKETFUNCTION to open/close c-ares sockets.
Thanks, but this description sounds as if you're asking for a new feature/change. We use this tracker for bugs and issues only, we put ideas to work on in the future in the TODO document. We basically drown in good ideas so they don't do much use in our tracker.
If you really want to see this happen, start working on an implementation and submit a PR for it or join the mailing list and talk up more interest for it and see what help from others you can get!
I did this
I am using the curl multi interface with boost::asio, which cannot wait on sockets without taking ownership of them. For most sockets this is fine, since curl will create them via the
CURLOPT_OPENSOCKETFUNCTION
callback and close them with theCURLOPT_CLOSESOCKETFUNCTION
callback, so asio can open and close them on its own. However, c-ares does not use those functions and instead opens and closes the sockets itself. This means that when curl passes the c-ares socket to theCURLMOPT_SOCKETFUNCTION
it isn't owned by asio, and asio can't take ownership of the socket because c-ares will later close the socket. This means the program can't wait on data from that socket and so can't callcurl_multi_socket_action
at the right time.I expected the following
Curl should use the
OPEN/CLOSESOCKETFUNCTION
to open/close c-ares sockets.curl/libcurl version
operating system
Linux, Windows
The text was updated successfully, but these errors were encountered: