From 1f74088586abee83bdeee88c6df13c944f210a12 Mon Sep 17 00:00:00 2001 From: Beaudan Date: Thu, 6 Jun 2019 16:33:28 +1000 Subject: [PATCH] Send to IP --- config/default.json | 2 +- js/modules/loki_message_api.js | 3 ++- js/modules/loki_snode_api.js | 14 ++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/config/default.json b/config/default.json index 9a98c6aa5..b0b5e0987 100644 --- a/config/default.json +++ b/config/default.json @@ -5,7 +5,7 @@ "contentProxyUrl": "random.snode", "localServerPort": "8081", "defaultPoWDifficulty": "100", - "seedNodeUrl": "13.238.53.205", + "seedNodeUrl": "3.104.19.14", "seedNodePort": "22023", "disableAutoUpdate": false, "updatesUrl": "https://updates2.signal.org/desktop", diff --git a/js/modules/loki_message_api.js b/js/modules/loki_message_api.js index f1bbddce3..ef86e215d 100644 --- a/js/modules/loki_message_api.js +++ b/js/modules/loki_message_api.js @@ -171,7 +171,8 @@ class LokiMessageAPI { async openSendConnection(params) { while (!_.isEmpty(this.sendingSwarmNodes[params.timestamp])) { const snode = this.sendingSwarmNodes[params.timestamp].shift(); - const successfulSend = await this.sendToNode(snode.address, snode.port, params); + // TODO: Revert back to using snode address instead of IP + const successfulSend = await this.sendToNode(snode.ip, snode.port, params); if (successfulSend) { return true; } diff --git a/js/modules/loki_snode_api.js b/js/modules/loki_snode_api.js index e7e276687..17d33753c 100644 --- a/js/modules/loki_snode_api.js +++ b/js/modules/loki_snode_api.js @@ -84,9 +84,9 @@ class LokiSnodeAPI { ); const snodes = result.result.service_node_states; this.randomSnodePool = snodes.map(snode => ({ - address: snode.public_ip, - port: snode.storage_port, - }) + address: snode.public_ip, + port: snode.storage_port, + }) ); } @@ -108,12 +108,9 @@ class LokiSnodeAPI { async updateLastHash(nodeUrl, lastHash, expiresAt) { await window.Signal.Data.updateLastHash({ nodeUrl, lastHash, expiresAt }); if (!this.ourSwarmNodes[nodeUrl]) { - this.ourSwarmNodes[nodeUrl] = { - lastHash, - }; - } else { - this.ourSwarmNodes[nodeUrl].lastHash = lastHash; + return; } + this.ourSwarmNodes[nodeUrl].lastHash = lastHash; } getSwarmNodesForPubKey(pubKey) { @@ -146,6 +143,7 @@ class LokiSnodeAPI { this.ourSwarmNodes[snode.address] = { lastHash, port: snode.port, + ip: snode.ip, }; }); await Promise.all(ps);