summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_url.class17
1 files changed, 10 insertions, 7 deletions
diff --git a/it_url.class b/it_url.class
index 626311c..ef17e53 100644
--- a/it_url.class
+++ b/it_url.class
@@ -378,19 +378,22 @@ static function get_multi($p=null)
$key = $keys[$info['handle']];
$content = curl_multi_getcontent($info['handle']);
- $closehandle($key);
-
EDC('reqtimings', $key, $info['result'], (gettimeofday(true) - $start) * 1000);
if ($info['result'] == CURLE_OK) {
if (!$p['noresults'])
$results_unordered[$key] = $content;
- } else if($retries[$key]++ < $p['retries'])
+
+ if (($handler = $urls[$key]['handler']))
+ $abort = $handler($info['handle'], $content);
+
+ $closehandle($key);
+ } else if($retries[$key]++ < $p['retries']) {
+ $closehandle($key); # closehandle must be called before addhandle as we use the same key
$addhandle($key);
- else
+ } else {
$results_unordered[$key] = false;
-
- if (($handler = $urls[$key]['handler']))
- $abort = $handler($info['result'], $content);
+ $closehandle($key);
+ }
if (!$abort && count($handles) < $parallel && $tofetch)
$addhandle(array_shift($tofetch));