Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

we're (mostly) ignoring the return of curl_multi_exec() #5

Open
divinity76 opened this issue Oct 14, 2020 · 0 comments
Open

we're (mostly) ignoring the return of curl_multi_exec() #5

divinity76 opened this issue Oct 14, 2020 · 0 comments

Comments

@divinity76
Copy link

divinity76 commented Oct 14, 2020

that's ok as long as it always returns CURLM_OK, which it is supposed to do, in lack of errors,

but per https://curl.haxx.se/libcurl/c/libcurl-errors.html it can also return other values, for example:

CURLM_OK (0)

Things are fine.

CURLM_OUT_OF_MEMORY (3)

You are doomed.

CURLM_UNKNOWN_OPTION (6)

curl_multi_setopt() with unsupported option (Added in 7.15.4)

CURLM_INTERNAL_ERROR (4)

This can only be returned if libcurl bugs. Please report it to us!

i suggest that instead of our current

while (curl_multi_exec($this->handle, $runningCount) === CURLM_CALL_MULTI_PERFORM);

approach, we do something like

do{
    $err = curl_multi_exec($this->handle, $runningCount);
} while($err === CURLM_CALL_MULTI_PERFORM);
if($err !== CURLM_OK){
    throw new \RuntimeException(...)
}

also error info can be obtained by doing something like:

                $errinfo = [
                    "multi_exec_return" => $err,
                    "curl_multi_errno" => curl_multi_errno($mh),
                    "curl_multi_strerror" => curl_multi_strerror($err)
                ];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant