From 2010704f14f7eacce35bd9a62eb5d37d2bac02ab Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 6 May 2020 20:58:48 +0200 Subject: [PATCH] fix only reconnecting the first time --- src/matrix/net/Reconnector.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/matrix/net/Reconnector.js b/src/matrix/net/Reconnector.js index 6855d3e5..298920f7 100644 --- a/src/matrix/net/Reconnector.js +++ b/src/matrix/net/Reconnector.js @@ -34,7 +34,9 @@ export class Reconnector { } async onRequestFailed(hsApi) { - if (!this._isReconnecting) { + if (!this._isReconnecting) { + this._isReconnecting = true; + const onlineStatusSubscription = this._onlineStatus && this._onlineStatus.subscribe(online => { if (online) { this.tryNow(); @@ -52,6 +54,7 @@ export class Reconnector { // unsubscribe from this._onlineStatus onlineStatusSubscription(); } + this._isReconnecting = false; } } } @@ -75,7 +78,6 @@ export class Reconnector { } async _reconnectLoop(hsApi) { - this._isReconnecting = true; this._versionsResponse = null; this._retryDelay.reset();