On Sat, 3 Apr 2021, Henrik Holst wrote:

(Let me just add some meat to this and explain this described behavior.)

As I wrote earlier, usually when you call curl_multi_add_handle(), the Timer Function CB is called once by curl with timeout set to 0. Then when you call curl_multi_socket_action() with CURL_SOCKET_TIMEOUT the Timer Function CB is usually called once more but this time with a timeout set to 1.

This description matches how libcurl *did* behave. More recent versions don't need to poll the name resolve results from the threaded resolver so the timeout pattern will be slightly different.

The application should of course still be prepared to deal with the timeouts libcurl asks for.

If you do not call curl_multi_socket_action() again with CURL_SOCKET_TIMEOUT after 1ms then curl stalls indefinitely since there will be no read or write events triggering the event handler to return events,

... because in that scenario libcurl waits to get called so that it can poll if the name resolve is done, and if you don't call libcurl then it won't notice that and it can't continue to perform its transfer until that's done!

--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to