Canary example

$deferred = $pauseDeferred;
                    $pauseDeferred = new Deferred();
                    $deferred->resolve();
                });
            }
        };

        $multi->lastTimeout = null;
        $multi->openHandles[$id] = $id;
        ++$multi->responseCount;

        $this->canary = new Canary(static function D) use ($canceller$multi$id) {
            $canceller->cancel();
            unset($multi->openHandles[$id]$multi->handlesActivity[$id]);
        });
    }

    public function getInfo(string $type = null): mixed
    {
        return null !== $type ? $this->info[$type] ?? null : $this->info;
    }

    public function __sleep(): array
    {
$this->initializer = static function Dself $response) {
            $waitFor = curl_getinfo($response->handle, \CURLINFO_PRIVATE);

            return 'H' === $waitFor[0];
        };

        // Schedule the request in a non-blocking way         $multi->lastTimeout = null;
        $multi->openHandles[$id] = [$ch$options];
        curl_multi_add_handle($multi->handle, $ch);

        $this->canary = new Canary(static function D) use ($ch$multi$id) {
            unset($multi->pauseExpiries[$id]$multi->openHandles[$id]$multi->handlesActivity[$id]);
            curl_setopt($ch, \CURLOPT_PRIVATE, '_0');

            if ($multi->performing) {
                return;
            }

            curl_multi_remove_handle($multi->handle, $ch);
            curl_setopt_array($ch[
                \CURLOPT_NOPROGRESS => true,
                \CURLOPT_PROGRESSFUNCTION => null,
                
$info['user_data'] = $options['user_data'];
        $info['max_duration'] = $options['max_duration'];
        ++$multi->responseCount;

        $this->initializer = static fn (self $response) => null === $response->remaining;

        $pauseExpiry = &$this->pauseExpiry;
        $info['pause_handler'] = static function Dfloat $duration) use (&$pauseExpiry) {
            $pauseExpiry = 0 < $duration ? hrtime(true) / 1E9 + $duration : 0;
        };

        $this->canary = new Canary(static function D) use ($multi$id) {
            if (null !== ($host = $multi->openHandles[$id][6] ?? null) && 0 >= --$multi->hosts[$host]) {
                unset($multi->hosts[$host]);
            }
            unset($multi->openHandles[$id]$multi->handlesActivity[$id]);
        });
    }

    public function getInfo(string $type = null): mixed
    {
        if (!$info = $this->finalInfo) {
            $info = $this->info;
            
Home | Imprint | This part of the site doesn't use cookies.