Execute and select curl handles until there is activity
bool $select Set to TRUE to select the file descriptors:
int $timeout Select timeout in seconds:
int $active Previous active value:
int Returns the number of active handles
private function executeHandles($select = false, $timeout = 1, $active = 0) {
do {
// @codeCoverageIgnoreStart
if ($select && $active && curl_multi_select($this->multiHandle, $timeout) == -1) {
// Perform a usleep if a previously executed select returned -1
// @see https://bugs.php.net/bug.php?id=61141
usleep(125);
}
// @codeCoverageIgnoreEnd
do {
$mrc = curl_multi_exec($this->multiHandle, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
// Check the return value to ensure an error did not occur
$this
->checkCurlResult($mrc);
// Poll once if not selecting, or poll until there are no handles with activity
} while ($select && $active);
return $active;
}