diff --git a/app/assets/js/movim_websocket.js b/app/assets/js/movim_websocket.js index 6762299de..f38e5d74f 100755 --- a/app/assets/js/movim_websocket.js +++ b/app/assets/js/movim_websocket.js @@ -22,7 +22,6 @@ WebSocket.prototype.unregister = function() { */ var MovimWebsocket = { - launchAttached : function() { for(var i = 0; i < this.attached.length; i++) { this.attached[i](); diff --git a/app/models/session/Session.php b/app/models/session/Session.php deleted file mode 100755 index 62777df6b..000000000 --- a/app/models/session/Session.php +++ /dev/null @@ -1,29 +0,0 @@ -_struct = ' - { - "name" : - {"type":"string", "size":32, "mandatory":true, "key":true }, - "value" : - {"type":"text", "mandatory":true }, - "session" : - {"type":"string", "size":128, "mandatory":true, "key":true }, - "container" : - {"type":"string", "size":16, "mandatory":true, "key":true }, - "timestamp" : - {"type":"date" } - }'; - - parent::__construct(); - } -} diff --git a/app/models/session/SessionDAO.php b/app/models/session/SessionDAO.php deleted file mode 100755 index 92f92fe2f..000000000 --- a/app/models/session/SessionDAO.php +++ /dev/null @@ -1,108 +0,0 @@ -_sql = ' - update session - set value = :value, - timestamp = :timestamp - where session = :session - and container = :container - and name = :name'; - - $this->prepare( - 'Session', - array( - 'session' => $session, - 'container' => $container, - 'name' => $name, - 'value' => $value, - 'timestamp' => $timestamp - ) - ); - - $this->run('Session'); - - if(!$this->_effective) { - $this->_sql = ' - insert into session - (name, value, session, container, timestamp) - values (:name, :value, :session, :container, :timestamp)'; - - $this->prepare( - 'Session', - array( - 'session' => $session, - 'container' => $container, - 'name' => $name, - 'value' => $value, - 'timestamp' => $timestamp - ) - ); - - return $this->run('Session'); - } - } - - function get($session, $container, $name) { - $this->_sql = ' - select * from session - where - session = :session - and container = :container - and name = :name'; - - $this->prepare( - 'Session', - array( - 'session' => $session, - 'container' => $container, - 'name' => $name - ) - ); - - return $this->run('Session', 'item'); - } - - function delete($session, $container, $name) { - $this->_sql = ' - delete from session - where - session = :session - and container = :container - and name = :name'; - - $this->prepare( - 'Session', - array( - 'session' => $session, - 'container' => $container, - 'name' => $name - ) - ); - - return $this->run('Session'); - } - - function deleteContainer($session, $container) { - $this->_sql = ' - delete from session - where - session = :session - and container = :container'; - - $this->prepare( - 'Session', - array( - 'session' => $session, - 'container' => $container, - ) - ); - - return $this->run('Session'); - } -} diff --git a/bootstrap.php b/bootstrap.php index 6a9e142c9..e63586462 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -284,7 +284,6 @@ class Bootstrap { $config = $cd->get(); define('LOG_LEVEL', (int)$config->loglevel); - //define('LOG_LEVEL', 2); } private function loadModl() { @@ -297,7 +296,6 @@ class Bootstrap { Modl\Utils::loadModel('Contact'); Modl\Utils::loadModel('Privacy'); Modl\Utils::loadModel('RosterLink'); - //Modl\Utils::loadModel('Session'); Modl\Utils::loadModel('Cache'); Modl\Utils::loadModel('Postn'); Modl\Utils::loadModel('Subscription'); diff --git a/linker.php b/linker.php index 34fff0403..d5e4ceeb0 100755 --- a/linker.php +++ b/linker.php @@ -34,7 +34,7 @@ React\Promise\all([$connector('ws://127.0.0.1:8080'), $connector($config->websoc if($msg != '') { $rpc = new RPC(); $rpc->handle_json($msg); - //$logger->notice("LOOP : Got message {$msg}"); + $logger->notice("LOOP : Got message {$msg}"); $xml = \Moxl\API::commit(); \Moxl\API::clear(); @@ -55,6 +55,18 @@ React\Promise\all([$connector('ws://127.0.0.1:8080'), $connector($config->websoc } } }); + + $conn1->on('error', function($msg) use ($conn1, $logger, $conn2, $loop) { + $logger->notice("LOOP : Got error {$msg}"); + $conn2->close(); + $loop->stop(); + }); + + $conn1->on('close', function($msg) use ($conn1, $logger, $conn2, $loop) { + $logger->notice("LOOP : Got close"); + if($conn2 != null) $conn2->close(); + if($loop != null) $loop->stop(); + }); $conn2->on('message', function($msg) use ($conn1, $logger, $conn2, $loop) { $logger->notice("XMPP : Got message from XMPP {$msg}"); @@ -91,13 +103,13 @@ React\Promise\all([$connector('ws://127.0.0.1:8080'), $connector($config->websoc } }); - $conn2->on('error', function($msg) use ($logger) { + $conn2->on('error', function($msg) use ($conn1, $logger, $conn2, $loop) { $logger->notice("XMPP : Got error {$msg}"); $conn1->close(); $loop->stop(); }); - $conn2->on('close', function($msg) use ($logger) { + $conn2->on('close', function($msg) use ($conn1, $logger, $conn2, $loop) { $logger->notice("XMPP : Got close"); if($conn1 != null) $conn1->close(); if($loop != null) $loop->stop(); diff --git a/src/Movim/Daemon/Behaviour.php b/src/Movim/Daemon/Behaviour.php index c57da38aa..1980d8e10 100755 --- a/src/Movim/Daemon/Behaviour.php +++ b/src/Movim/Daemon/Behaviour.php @@ -6,7 +6,6 @@ use Ratchet\ConnectionInterface; class Behaviour implements MessageComponentInterface { protected $sessions = array(); // Store the sessions - //protected $process; protected $baseuri; public function __construct($baseuri, $port) { @@ -52,9 +51,9 @@ class Behaviour implements MessageComponentInterface { switch ($msg->func) { // The browser ask for a new session - case 'unregister': + case 'unregister': if(array_key_exists('linker', $this->sessions[$sid])) { - $this->sessions[$sid]['process']->terminate(); + $this->sessions[$sid]['linker']->close(); } break;