protected function sessionStart($force_start = true)
{
if ($this->sessionStarted) {
return;
}
$this->sessionStarted = true;
if (!$this instanceof \PHPDaemon\HTTPRequest\Generic) {
Daemon::log('Called ' . get_class($this) . '(trait \\PHPDaemon\\Traits\\Sessions)->sessionStart() outside of Request. You should use onSessionStart.');
return;
}
$f = true;
// hack to avoid a sort of "race condition"
$this->onSessionStart(function ($event) use(&$f) {
$f = false;
$this->wakeup();
});
if ($f) {
$this->sleep($this->sessionStartTimeout);
}
}