You are here

public function CurlMultiHandler::tick in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php \GuzzleHttp\Handler\CurlMultiHandler::tick()

Ticks the curl event loop.

1 call to CurlMultiHandler::tick()
CurlMultiHandler::execute in vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
Runs until all outstanding connections have completed.

File

vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php, line 79

Class

CurlMultiHandler
Returns an asynchronous response using curl_multi_* functions.

Namespace

GuzzleHttp\Handler

Code

public function tick() {

  // Add any delayed handles if needed.
  if ($this->delays) {
    $currentTime = microtime(true);
    foreach ($this->delays as $id => $delay) {
      if ($currentTime >= $delay) {
        unset($this->delays[$id]);
        curl_multi_add_handle($this->_mh, $this->handles[$id]['easy']->handle);
      }
    }
  }

  // Step through the task queue which may add additional requests.
  P\queue()
    ->run();
  if ($this->active && curl_multi_select($this->_mh, $this->selectTimeout) === -1) {

    // Perform a usleep if a select returns -1.
    // See: https://bugs.php.net/bug.php?id=61141
    usleep(250);
  }
  while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM) {
  }
  $this
    ->processMessages();
}