diff options
author | Aleš Smodiš <aless@guru.si> | 2015-12-15 16:58:13 +0100 |
---|---|---|
committer | Aleš Smodiš <aless@guru.si> | 2015-12-15 16:58:13 +0100 |
commit | 2f1982456f85b156e152864b4d327c46a0adc4fe (patch) | |
tree | c5697ebd47d51e8b6880e69afae9f934f770fa0e /js/codeq/comms.js | |
parent | 6d879afe4c423de9bdac9eeb6a8d3f8aa4526378 (diff) |
Implement codeq.comms.forceReset() to better handle possible timeouts and resulting blockage in codeq.reset().
Diffstat (limited to 'js/codeq/comms.js')
-rw-r--r-- | js/codeq/comms.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/codeq/comms.js b/js/codeq/comms.js index e964f20..5e046b7 100644 --- a/js/codeq/comms.js +++ b/js/codeq/comms.js @@ -557,6 +557,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ 'samlLogout': function(){ return this.send({'action':'saml_logout'}); + }, + + 'forceReset': function () { + var p; + if (sid !== null) { + p = Q.Promise(function (resolve, reject, notify) { + var t = setTimeout(function () { + t = null; + resolve(); + }, 3000); // 3 seconds + codeq.comms.logout().then(function () { + if (t !== null) { + clearTimeout(t); + t = null; + resolve(); + } + }); + }); + } + else p = Q(); + return p.fin(codeq.comms.disconnect); } }; })(); |