Aerys\Server::timeoutKeepAlives PHP Method

timeoutKeepAlives() private method

private timeoutKeepAlives ( integer $now )
$now integer
    private function timeoutKeepAlives(int $now)
    {
        $timeouts = [];
        foreach ($this->keepAliveTimeouts as $id => $expiresAt) {
            if ($now > $expiresAt) {
                $timeouts[] = $this->clients[$id];
            } else {
                break;
            }
        }
        foreach ($timeouts as $client) {
            // do not close in case some longer response is taking longer, but do in case bodyPromisors aren't fulfilled
            if ($client->pendingResponses > \count($client->bodyPromisors)) {
                $this->clearKeepAliveTimeout($client);
            } else {
                // timeouts are only active while Client is doing nothing (not sending nor receving) and no pending writes, hence we can just fully close here
                $this->close($client);
            }
        }
    }