Home > Blockchain >  Impact of not handling the return code CURLM_CALL_MULTI_PERFORM of curl_multi_perform()
Impact of not handling the return code CURLM_CALL_MULTI_PERFORM of curl_multi_perform()

Time:08-15

I am currently studying libcurl multi API.

I am curious about what will happen if I skip checking CURLM_CALL_MULTI_PERFORM return code from curl_multi_perform().

According to https://linux.die.net/man/3/curl_multi_perform

If you receive CURLM_CALL_MULTI_PERFORM, this basically means that you should call curl_multi_perform again, before you select() on more actions. You don't have to do it immediately, but the return code means that libcurl may have more data available to return or that there may be more data to send off before it is "satisfied". Do note that curl_multi_perform(3) will return CURLM_CALL_MULTI_PERFORM only when it wants to be called again immediately. When things are fine and there is nothing immediate it wants done, it'll return CURLM_OK and you need to wait for "action" and then call this function again.

Does anyone have any idea? I am using libcurl version 7.65.3 and my driver code is in C language. Thanks!

CodePudding user response:

CURLM_CALL_MULTI_PERFORM is deprecated since curl 7.20 and will never be returned, as documented 10 years ago.

The reason of the deprecation was rare proper use of that feature, there were numerous mistakes and misunderstandings. So since 7.20.0 CURLM_CALL_MULTI_PERFORM is no more existing.

I recommend that you consult the official manual curl_multi_perform instead of 3rd party man pages.

CodePudding user response:

Here is the interesting part of curl_multi_perform():

  data = multi->easyp;
  while(data) {
    CURLMcode result;
    SIGPIPE_VARIABLE(pipe_st);

    sigpipe_ignore(data, &pipe_st);
    result = multi_runsingle(multi, &now, data);
    sigpipe_restore(&pipe_st);

    if(result)
      returncode = result;

    data = data->next; /* operate on next handle */
  }

As it says there is data which will not be processed (via multi_runsingle()) and what that is depends on what you have in flight.

  • Related