src/Server/BasicServer.php
public function accept(bool $autoClose = true): \Generator
    {
        while (!$this->queue->isEmpty()) {
            /** @var \Icicle\Awaitable\Delayed $delayed */
            $delayed = $this->queue->bottom();
            yield $delayed; // Wait for previous accept to complete.
        }
        
        if (!$this->isOpen()) {
            throw new UnavailableException('The server has been closed.');
        }

        // Error reporting suppressed since stream_socket_accept() emits E_WARNING on client accept failure.
        $socket = @stream_socket_accept($this->getResource(), 0); // Timeout of 0 to be non-blocking.

        if ($socket) {
            return $this->createSocket($socket, $autoClose);
        }

        $this->queue->push($delayed = new Delayed($this->onCancelled));
        $this->poll->listen();

        return $this->createSocket(yield $delayed, $autoClose);
    }
public function accept(bool $autoClose = true): \Generator
    {
        while (!$this->queue->isEmpty()) {
            /** @var \Icicle\Awaitable\Delayed $delayed */
            $delayed = $this->queue->bottom();
            yield $delayed; // Wait for previous accept to complete.
        }
        
        if (!$this->isOpen()) {
            throw new UnavailableException('The server has been closed.');
        }

        // Error reporting suppressed since stream_socket_accept() emits E_WARNING on client accept failure.
        $socket = @stream_socket_accept($this->getResource(), 0); // Timeout of 0 to be non-blocking.

        if ($socket) {
            return $this->createSocket($socket, $autoClose);
        }

        $this->queue->push($delayed = new Delayed($this->onCancelled));
        $this->poll->listen();

        return $this->createSocket(yield $delayed, $autoClose);
    }
{@inheritdoc}