public function handshake()
{
$this->route = $this->pool->getRoute($this->server['DOCUMENT_URI'], $this);
if (!$this->route) {
Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot handshake session for client "' . $this->addr . '"');
$this->finish();
return false;
}
if (method_exists($this->route, 'onBeforeHandshake')) {
$this->route->onWakeup();
$ret = $this->route->onBeforeHandshake(function () {
$this->handshakeAfter();
});
if ($this->route) {
$this->route->onSleep();
}
if ($ret !== false) {
return;
}
}
$this->handshakeAfter();
}