fixed incorrect behavior when loopback or tunnel initially fails

This commit is contained in:
tigerbot 2017-10-27 13:49:37 -06:00
parent b1d5ed3b14
commit 5de8edb33d
1 changed files with 7 additions and 2 deletions

View File

@ -130,8 +130,6 @@ module.exports.create = function (deps, conf) {
return;
}
localAddr = addr;
gateway = gw;
var loopResult = await loopback(loopbackDomain);
var notLooped = Object.keys(loopResult.ports).filter(function (port) {
return !loopResult.ports[port];
@ -153,6 +151,13 @@ module.exports.create = function (deps, conf) {
await connectAllTunnels();
}
}
// Don't assign these until the end of the function. This means that if something failed
// in the loopback or tunnel connection that we will try to go through the whole process
// again next time and hopefully the error is temporary (but if not I'm not sure what the
// correct course of action would be anyway).
localAddr = addr;
gateway = gw;
}
var publicAddress;