made DDNS care less when checking the gateway fails

This commit is contained in:
tigerbot 2017-11-03 15:16:30 -06:00
parent ef5dcb81f4
commit 28f28c6eb9
1 changed files with 10 additions and 1 deletions

View File

@ -124,8 +124,17 @@ module.exports.create = function (deps, conf) {
// Since we can't detect the OS level events when a user plugs in an ethernet cable to recheck // Since we can't detect the OS level events when a user plugs in an ethernet cable to recheck
// what network environment we are in we check our local network address and the gateway to // what network environment we are in we check our local network address and the gateway to
// determine if we need to run the loopback check and router configuration again. // determine if we need to run the loopback check and router configuration again.
var gw = await network.getGatewayIpAsync();
var addr = await network.getPrivateIpAsync(); var addr = await network.getPrivateIpAsync();
// Until the author of the `network` package publishes the pull request we gave him
// checking the gateway on our units fails because we have the busybox versions of
// the linux commands. Gateway is realistically less important than address, so if
// we fail in getting it go ahead and use the null value.
var gw;
try {
gw = await network.getGatewayIpAsync();
} catch (err) {
gw = null;
}
if (localAddr === addr && gateway === gw) { if (localAddr === addr && gateway === gw) {
return; return;
} }