Don't auto-reconnect provisioning socket

// FREEBIE
This commit is contained in:
lilia 2015-07-27 12:49:31 -07:00
parent 15cd348bf2
commit 0d0bdbf998
3 changed files with 10 additions and 8 deletions

View file

@ -38406,10 +38406,11 @@ axolotlInternal.RecipientRecord = function() {
* *
*/ */
TextSecureWebSocket = function (url) { TextSecureWebSocket = function (url, opts) {
'use strict'; 'use strict';
opts = opts || {};
var reconnectTimeout = opts.reconnectTimeout || 1000;
var reconnectSemaphore = 0; var reconnectSemaphore = 0;
var reconnectTimeout = 1000;
var socket; var socket;
var calledClose = false; var calledClose = false;
var socketWrapper = { var socketWrapper = {
@ -38422,7 +38423,7 @@ TextSecureWebSocket = function (url) {
var error; var error;
function onclose(e) { function onclose(e) {
if (!error && !calledClose) { if (!error && !calledClose && reconnectTimeout) {
reconnectSemaphore--; reconnectSemaphore--;
setTimeout(connect, reconnectTimeout); setTimeout(connect, reconnectTimeout);
} }
@ -39266,7 +39267,7 @@ TextSecureServer = function () {
self.getTempWebsocket = function() { self.getTempWebsocket = function() {
var url = URL_BASE.replace(/^http/g, 'ws') + URL_CALLS['temp_push'] + '/?'; var url = URL_BASE.replace(/^http/g, 'ws') + URL_CALLS['temp_push'] + '/?';
return TextSecureWebSocket(url); return TextSecureWebSocket(url, {reconnectTimeout: false});
} }
return self; return self;

View file

@ -329,7 +329,7 @@ TextSecureServer = function () {
self.getTempWebsocket = function() { self.getTempWebsocket = function() {
var url = URL_BASE.replace(/^http/g, 'ws') + URL_CALLS['temp_push'] + '/?'; var url = URL_BASE.replace(/^http/g, 'ws') + URL_CALLS['temp_push'] + '/?';
return TextSecureWebSocket(url); return TextSecureWebSocket(url, {reconnectTimeout: false});
} }
return self; return self;

View file

@ -22,10 +22,11 @@
* *
*/ */
TextSecureWebSocket = function (url) { TextSecureWebSocket = function (url, opts) {
'use strict'; 'use strict';
opts = opts || {};
var reconnectTimeout = opts.reconnectTimeout || 1000;
var reconnectSemaphore = 0; var reconnectSemaphore = 0;
var reconnectTimeout = 1000;
var socket; var socket;
var calledClose = false; var calledClose = false;
var socketWrapper = { var socketWrapper = {
@ -38,7 +39,7 @@ TextSecureWebSocket = function (url) {
var error; var error;
function onclose(e) { function onclose(e) {
if (!error && !calledClose) { if (!error && !calledClose && reconnectTimeout) {
reconnectSemaphore--; reconnectSemaphore--;
setTimeout(connect, reconnectTimeout); setTimeout(connect, reconnectTimeout);
} }