|
|
@ -10,7 +10,7 @@ class Core implements MessageComponentInterface { |
|
|
public $loop; |
|
|
public $loop; |
|
|
public $baseuri; |
|
|
public $baseuri; |
|
|
|
|
|
|
|
|
private $cleanerdelay = 24; // in hours
|
|
|
|
|
|
|
|
|
private $cleanerdelay = 12; // in hours
|
|
|
|
|
|
|
|
|
public function __construct($loop, $baseuri, $port) |
|
|
public function __construct($loop, $baseuri, $port) |
|
|
{ |
|
|
{ |
|
|
@ -112,7 +112,9 @@ class Core implements MessageComponentInterface { |
|
|
{ |
|
|
{ |
|
|
$this->loop->addPeriodicTimer(5, function() { |
|
|
$this->loop->addPeriodicTimer(5, function() { |
|
|
foreach($this->sessions as $sid => $session) { |
|
|
foreach($this->sessions as $sid => $session) { |
|
|
if(time()-$session->timestamp > $this->cleanerdelay*3600) { |
|
|
|
|
|
|
|
|
if((time()-$session->timestamp > $this->cleanerdelay*3600) |
|
|
|
|
|
|| ($session->countClients() == 0 |
|
|
|
|
|
&& $session->registered == null)) { |
|
|
$session->killLinker(); |
|
|
$session->killLinker(); |
|
|
$this->closeEmptySession($sid); |
|
|
$this->closeEmptySession($sid); |
|
|
} |
|
|
} |
|
|
@ -124,7 +126,7 @@ class Core implements MessageComponentInterface { |
|
|
{ |
|
|
{ |
|
|
// No WebSockets and no linker ? We close the whole session
|
|
|
// No WebSockets and no linker ? We close the whole session
|
|
|
if($this->sessions[$sid]->countClients() == 0 |
|
|
if($this->sessions[$sid]->countClients() == 0 |
|
|
&& $this->sessions[$sid]->process == null) { |
|
|
|
|
|
|
|
|
&& ($this->sessions[$sid]->process == null)) { |
|
|
$sd = new \Modl\SessionxDAO(); |
|
|
$sd = new \Modl\SessionxDAO(); |
|
|
$sd->delete($sid); |
|
|
$sd->delete($sid); |
|
|
|
|
|
|
|
|
|