private function onReadable(string $watcherId, $socket, $client)
{
$data = @\fread($socket, $this->options->ioGranularity);
if ($data == "") {
if (!\is_resource($socket) || @\feof($socket)) {
if ($client->isDead == Client::CLOSED_WR || $client->pendingResponses == 0) {
$this->close($client);
} else {
$client->isDead = Client::CLOSED_RD;
\Amp\cancel($watcherId);
$client->readWatcher = null;
if ($client->bodyPromisors) {
$ex = new ClientException();
foreach ($client->bodyPromisors as $promisor) {
$promisor->fail($ex);
}
$client->bodyPromisors = [];
}
}
}
return;
}
$this->renewKeepAliveTimeout($client);
$client->requestParser->send($data);
}