From 75269f4ccf8def283137552eeffd9813c8a7a74c Mon Sep 17 00:00:00 2001 From: Jijo Joseph Date: Mon, 18 Sep 2023 11:48:49 +0530 Subject: [PATCH] Fix issue with network check waiting loop --- app/connectionManager/index.js | 48 +++++++++---------- ...IsmaelMartinez.teams_for_linux.appdata.xml | 7 +++ package.json | 2 +- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/app/connectionManager/index.js b/app/connectionManager/index.js index f5e5dc6c..209fa52f 100644 --- a/app/connectionManager/index.js +++ b/app/connectionManager/index.js @@ -81,7 +81,7 @@ class ConnectionManager { const onlineCheckMethod = this.config.onlineCheckMethod; var resolved = false; for (var i = 1; i <= retries && !resolved; i++) { - resolved = this.isOnlineTest(onlineCheckMethod, this.config.url); + resolved = await this.isOnlineTest(onlineCheckMethod, this.config.url); if (!resolved) await sleep(timeout); } if (resolved) { @@ -94,29 +94,29 @@ class ConnectionManager { async isOnlineTest(onlineCheckMethod, testUrl) { switch (onlineCheckMethod) { - case 'none': - // That's more an escape gate in case all methods are broken, it disables - // the network test (assumes we're online). - this.logger.warn('Network test is disabled, assuming online status.'); - return true; - case 'dns': - // Sometimes too optimistic, might be false-positive where an HTTP proxy is - // mandatory but not reachable yet. - const testDomain = (new URL(testUrl)).hostname; - this.logger.debug('Testing network using net.resolveHost() for ' + testDomain); - return await isOnlineDns(testDomain); - - case 'native': - // Sounds good but be careful, too optimistic in my experience; and at the contrary, - // might also be false negative where no DNS is available for internet domains, but - // an HTTP proxy is actually available and working. - this.logger.debug('Testing network using net.isOnline()'); - return net.isOnline(); - case 'https': - default: - // Perform an actual HTTPS request, similar to loading the Teams app. - this.logger.debug('Testing network using net.request() for ' + testUrl); - return await isOnlineHttps(testUrl); + case 'none': + // That's more an escape gate in case all methods are broken, it disables + // the network test (assumes we're online). + this.logger.warn('Network test is disabled, assuming online status.'); + return true; + case 'dns': { + // Sometimes too optimistic, might be false-positive where an HTTP proxy is + // mandatory but not reachable yet. + const testDomain = (new URL(testUrl)).hostname; + this.logger.debug('Testing network using net.resolveHost() for ' + testDomain); + return await isOnlineDns(testDomain); + } + case 'native': + // Sounds good but be careful, too optimistic in my experience; and at the contrary, + // might also be false negative where no DNS is available for internet domains, but + // an HTTP proxy is actually available and working. + this.logger.debug('Testing network using net.isOnline()'); + return net.isOnline(); + case 'https': + default: + // Perform an actual HTTPS request, similar to loading the Teams app. + this.logger.debug('Testing network using net.request() for ' + testUrl); + return await isOnlineHttps(testUrl); } } } diff --git a/com.github.IsmaelMartinez.teams_for_linux.appdata.xml b/com.github.IsmaelMartinez.teams_for_linux.appdata.xml index daabb23d..72c3bee0 100644 --- a/com.github.IsmaelMartinez.teams_for_linux.appdata.xml +++ b/com.github.IsmaelMartinez.teams_for_linux.appdata.xml @@ -14,6 +14,13 @@ https://github.com/IsmaelMartinez/teams-for-linux/issues com.github.IsmaelMartinez.teams_for_linux.desktop + + +
    +
  • Fix: A glitch in network waiting loop
  • +
+
+
    diff --git a/package.json b/package.json index 46298a41..0e30bbee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teams-for-linux", - "version": "1.3.10", + "version": "1.3.11", "main": "app/index.js", "description": "Unofficial client for Microsoft Teams for Linux", "homepage": "https://github.com/IsmaelMartinez/teams-for-linux",