protected function handshakeAfter()
{
$extraHeaders = '';
foreach ($this->headers as $k => $line) {
if ($k !== 'STATUS') {
$extraHeaders .= $line . "\r\n";
}
}
if (!$this->sendHandshakeReply($extraHeaders)) {
Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Handshake protocol failure for client "' . $this->addr . '"');
$this->finish();
return false;
}
$this->handshaked = true;
$this->headers_sent = true;
$this->state = static::STATE_HANDSHAKED;
if (is_callable([$this->route, 'onHandshake'])) {
$this->route->onWakeup();
$this->route->onHandshake();
if ($this->route) {
$this->route->onSleep();
}
}
return true;
}