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 Returns the number of active handles
private function executeHandles($select = false, $timeout = 1) {
$active = $selectResult = 0;
do {
if ($select) {
$selectResult = curl_multi_select($this->multiHandle, $timeout);
}
if ($selectResult === 0) {
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 && $selectResult == 0);
return $active;
}