diff options
author | Nathan Gass | 2011-10-25 14:23:02 +0000 |
---|---|---|
committer | Nathan Gass | 2011-10-25 14:23:02 +0000 |
commit | 2371a9c7d1c0d8ce89a740fc37325eecf7d6ffcd (patch) | |
tree | 4ac5e6a0b4693153119ff3950bdffee8ec87e7fe | |
parent | 72def8e17325a12a097789800837cbb8d7df2697 (diff) | |
download | itools-2371a9c7d1c0d8ce89a740fc37325eecf7d6ffcd.tar.gz itools-2371a9c7d1c0d8ce89a740fc37325eecf7d6ffcd.tar.bz2 itools-2371a9c7d1c0d8ce89a740fc37325eecf7d6ffcd.zip |
replace busy curl_multi loop by correct curl_multi loop from php doku
-rw-r--r-- | it_url.class | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/it_url.class b/it_url.class index baac7c7..d943346 100644 --- a/it_url.class +++ b/it_url.class @@ -389,9 +389,20 @@ function get_multi($p=null) curl_multi_add_handle($mh, $ch[$key]); } + // curl_multi loop copied from example at http://php.net/manual/en/function.curl-multi-exec.php + $active = null; + //execute the handles do { - curl_multi_exec($mh, $running); - } while ($running > 0); + $mrc = curl_multi_exec($mh, $active); + } while ($mrc == CURLM_CALL_MULTI_PERFORM); + + while ($active && $mrc == CURLM_OK) { + if (curl_multi_select($mh) != -1) { + do { + $mrc = curl_multi_exec($mh, $active); + } while ($mrc == CURLM_CALL_MULTI_PERFORM); + } + } $results = array(); foreach ($p['urls'] as $key => $url) |