diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 959e94094a..790eb645b6 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 8f0a983468..2d37d9c209 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; } };