From 2b210b3fcd96bb85e56126c7f4ec04bbb80e60a3 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 12 Sep 2016 11:43:48 -0700 Subject: [PATCH] Fix undefined websocket port Fixes #889 // FREEBIE --- js/libtextsecure.js | 4 +++- libtextsecure/api.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 959e9409..790eb645 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -37482,7 +37482,9 @@ function PortManager(ports) { PortManager.prototype = { constructor: PortManager, getPort: function() { - return this.ports[this.idx++]; + var port = this.ports[this.idx]; + this.idx = (this.idx + 1) % this.ports.length; + return port; } }; diff --git a/libtextsecure/api.js b/libtextsecure/api.js index 8f0a9834..2d37d9c2 100644 --- a/libtextsecure/api.js +++ b/libtextsecure/api.js @@ -10,7 +10,9 @@ function PortManager(ports) { PortManager.prototype = { constructor: PortManager, getPort: function() { - return this.ports[this.idx++]; + var port = this.ports[this.idx]; + this.idx = (this.idx + 1) % this.ports.length; + return port; } };