Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with network check waiting loop #954

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions app/connectionManager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions com.github.IsmaelMartinez.teams_for_linux.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
<url type="bugtracker">https://github.com/IsmaelMartinez/teams-for-linux/issues</url>
<launchable type="desktop-id">com.github.IsmaelMartinez.teams_for_linux.desktop</launchable>
<releases>
<release version="1.3.11" date="2023-09-18">
<description>
<ul>
<li>Fix: A glitch in network waiting loop</li>
</ul>
</description>
</release>
<release version="1.3.10" date="2023-09-07">
<description>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading