From 5de8edb33d4942cbd16923bc4840e09127e000be Mon Sep 17 00:00:00 2001 From: tigerbot Date: Fri, 27 Oct 2017 13:49:37 -0600 Subject: [PATCH] fixed incorrect behavior when loopback or tunnel initially fails --- lib/ddns/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ddns/index.js b/lib/ddns/index.js index df70ab9..dbcb3c2 100644 --- a/lib/ddns/index.js +++ b/lib/ddns/index.js @@ -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;