From 2f1982456f85b156e152864b4d327c46a0adc4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 15 Dec 2015 16:58:13 +0100 Subject: Implement codeq.comms.forceReset() to better handle possible timeouts and resulting blockage in codeq.reset(). --- js/codeq/comms.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'js/codeq/comms.js') 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 . */ '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); } }; })(); -- cgit v1.2.1