diff --git a/js/background.js b/js/background.js index 7ea19d76ab4..270ce065707 100644 --- a/js/background.js +++ b/js/background.js @@ -185,6 +185,10 @@ disconnectTimer = null; return; } + if (disconnectTimer) { + clearTimeout(disconnectTimer); + disconnectTimer = null; + } connect(); } diff --git a/js/libtextsecure.js b/js/libtextsecure.js index a28b064deb6..9547372c584 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38351,7 +38351,7 @@ var TextSecureServer = (function() { ev.code = code; ev.reason = reason; this.dispatchEvent(ev); - }.bind(this), 10000); + }.bind(this), 1000); }; }; window.WebSocketResource.prototype = new textsecure.EventTarget(); @@ -38435,6 +38435,10 @@ MessageReceiver.prototype = new textsecure.EventTarget(); MessageReceiver.prototype.extend({ constructor: MessageReceiver, connect: function() { + if (this.calledClose) { + return; + } + this.hasConnected = true; if (this.socket && this.socket.readyState !== WebSocket.CLOSED) { @@ -38485,8 +38489,6 @@ MessageReceiver.prototype.extend({ this.wsr.close(3000, 'called close'); } - this.shutdown(); - return this.drain(); }, onopen: function() { diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index cfb11c7f00c..7c32df69914 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -28,6 +28,10 @@ MessageReceiver.prototype = new textsecure.EventTarget(); MessageReceiver.prototype.extend({ constructor: MessageReceiver, connect: function() { + if (this.calledClose) { + return; + } + this.hasConnected = true; if (this.socket && this.socket.readyState !== WebSocket.CLOSED) { @@ -78,8 +82,6 @@ MessageReceiver.prototype.extend({ this.wsr.close(3000, 'called close'); } - this.shutdown(); - return this.drain(); }, onopen: function() { diff --git a/libtextsecure/websocket-resources.js b/libtextsecure/websocket-resources.js index 239c9f7e1a4..30a519fb152 100644 --- a/libtextsecure/websocket-resources.js +++ b/libtextsecure/websocket-resources.js @@ -182,7 +182,7 @@ ev.code = code; ev.reason = reason; this.dispatchEvent(ev); - }.bind(this), 10000); + }.bind(this), 1000); }; }; window.WebSocketResource.prototype = new textsecure.EventTarget();