made DDNS care less when checking the gateway fails

This commit is contained in:
tigerbot 2017-11-03 15:16:30 -06:00
父節點 ef5dcb81f4
當前提交 28f28c6eb9
共有 1 個檔案被更改,包括 10 行新增1 行删除

查看文件

@ -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
// 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.
var gw = await network.getGatewayIpAsync();
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) {
return;
}