@ -49,6 +49,7 @@ class CurlDownloader
CURLM_OUT_OF_MEMORY => array('CURLM_OUT_OF_MEMORY', 'You are doomed.'),
CURLM_OUT_OF_MEMORY => array('CURLM_OUT_OF_MEMORY', 'You are doomed.'),
CURLM_INTERNAL_ERROR => array('CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!'),
CURLM_INTERNAL_ERROR => array('CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!'),
);
);
private $lastInfoUpdate = 0;
private static $options = array(
private static $options = array(
'http' => array(
'http' => array(
@ -240,6 +241,7 @@ class CurlDownloader
}
}
$this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $curlHandle));
$this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $curlHandle));
$this->lastInfoUpdate = 0;
// TODO progress
// TODO progress
return (int) $curlHandle;
return (int) $curlHandle;
@ -390,6 +392,9 @@ class CurlDownloader
}
}
}
}
if (microtime(true) - $this->lastInfoUpdate > 0.1) {
$this->lastInfoUpdate = microtime(true);
foreach ($this->jobs as $i => $curlHandle) {
foreach ($this->jobs as $i => $curlHandle) {
if (!isset($this->jobs[$i])) {
if (!isset($this->jobs[$i])) {
continue;
continue;
@ -415,6 +420,8 @@ class CurlDownloader
// TODO progress
// TODO progress
}
}
}
}
}
}
}
private function handleRedirect(array $job, Response $response, array $responseInfo)
private function handleRedirect(array $job, Response $response, array $responseInfo)