Skip to content

Commit 69528f8

Browse files
author
David White
committed
Bugfix for connection errors and change config file import logic
When going from apiport, routerIP config to just upnp in config file, It was wiping the old mappings as it detected a port change when there wasn't. Upon further reflection, there isn't really a good way to implement this without impacting any existing api / app connections. So Have removed. Fixes a logic error with the config file import - on every config reload, the computed properties were being overwritten. There could have been edgecases where these properties were needed during the time they were being re-evaluted. Now only import the initial values and don't wipe the computed before they are recalculated.
1 parent 7ef15df commit 69528f8

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

ZelBack/src/services/fluxportControllerService.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ async function startGossipServer() {
9090
if (ip && ip !== routerIp) {
9191
log.info(`Gossip server got new routerIp: ${ip}, updating`);
9292
await upnpService.ufwRemoveAllowSsdpforInit();
93-
// This is just good hygiene
94-
await upnpService.cleanOldMappings(ip);
93+
// removed this. Regarding control plane / data plane. If Flux
94+
// control plane goes down, it shouldn't interfere with the data plane.
95+
// This was more aimed at if we have mappings that don't belong to this node.
96+
// Maybe look up the descriptions? or just let them time out...
97+
// await upnpService.cleanOldMappings(ip);
9598
routerIp = ip;
9699
}
97100
});

ZelBack/src/services/upnpService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ async function ufwRemoveAllowSsdpforInit() {
7474
await cmdAsync(removeAllowSsdpCmd);
7575
return true;
7676
} catch (error) {
77+
// above rule returns 0 for non existent rule so this shouldn't fire unless actual error
7778
log.error(error);
7879
return false;
7980
}

apiServer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async function loadUpnpIfSupported(autoUpnp) {
115115
}
116116

117117
async function SetupPortsUpnpAndComputed() {
118-
userconfig.computed = {};
118+
if (!userconfig.computed) userconfig.computed = {};
119119

120120
const tags = validateTags();
121121
const autoUpnp = userconfig.initial.upnp || false;
@@ -167,8 +167,10 @@ async function configReload() {
167167
initialHash = hashCurrent;
168168
log.info(`Config file changed, reloading ${event.filename}...`);
169169
delete require.cache[require.resolve('./config/userconfig')];
170+
// only reimport initial - so we don't overwrite computed as other
171+
//routines may be using this
170172
// eslint-disable-next-line
171-
userconfig = require('./config/userconfig');
173+
userconfig.initial = require('./config/userconfig').initial;
172174
await SetupPortsUpnpAndComputed();
173175
}
174176
}

0 commit comments

Comments
 (0)