From a00aa7371517b85839c7a044ab68a6b0992e330c Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Wed, 18 Mar 2020 17:38:13 -0700 Subject: [PATCH] disconnect even if it's been stopped before, logging improvements --- libtextsecure/http-resources.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libtextsecure/http-resources.js b/libtextsecure/http-resources.js index 04de289cd..02d647ef5 100644 --- a/libtextsecure/http-resources.js +++ b/libtextsecure/http-resources.js @@ -84,6 +84,8 @@ }; this.pollServer = async () => { + // bg.connect calls mr connect after storage system is ready + window.log.info('http-resource pollServer start'); // This blocking call will return only when all attempts // at reaching snodes are exhausted or a DNS error occured try { @@ -93,25 +95,30 @@ messages => { connected = true; messages.forEach(message => { - const { data } = message; - this.handleMessage(data); + this.handleMessage(message.data); }); } ); } catch (e) { // we'll try again anyway - window.log.error('http-resource pollServer error', e.code, e.message); + window.log.error( + 'http-resource pollServer error', + e.code, + e.message, + e.stack + ); } + connected = false; if (this.calledStop) { + // don't restart return; } - connected = false; // Exhausted all our snodes urls, trying again later from scratch setTimeout(() => { window.log.info( - `Exhausted all our snodes urls, trying again in ${EXHAUSTED_SNODES_RETRY_DELAY / + `http-resource: Exhausted all our snodes urls, trying again in ${EXHAUSTED_SNODES_RETRY_DELAY / 1000}s from scratch` ); this.pollServer();