curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Question regarding passing CURL_SOCKET_TIMEOUT to multi_socket_action

From: Yongkang Huang via curl-library <curl-library_at_lists.haxx.se>
Date: Sun, 24 Oct 2021 08:05:52 +0000

Hi!

Iím working on an application that driving a multi handle on an event base that dynamically adding easy handle when thereís a server request demand some HTTP request in the backend. Here are some of mu problems



  1. After add an easy handle using curl_multi_add_handle, I call curl_multi_socket_action with CURL_SOCKET_TIMEOUT to start the easy handle, after that I check the immediately whether running_handles is 0, if it is 0 I deemed it would be an exception that the easy handle I just added failed to start, sometime I do notice the running_handle is 0 while curl_multi_add_handle returns no error.


  curl_multi_add_handle(curlm, curl);



  int running = 0;

  auto rc = curl_multi_socket_action(curlm, CURL_SOCKET_TIMEOUT, 0, &running);

  if (rc != CURLM_OK || running == 0) {

    // oops there's some error

  }

So is running_handle is 0 legit in this case that I should call curl_multi_info_read to read the result?

  1. When a curl_multi_socket_action returns error code, should I just think all the existing easy handle added are failed and the multi handle cannot be used anymore? Or is there any recovery mechanism?


Thanks!


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-10-24