Skip to content
Snippets Groups Projects

[fix] async dep upgrade break wizard network

Merged Éloïs requested to merge fix/wizard-network into dev
1 file
+ 18
18
Compare changes
  • Side-by-side
  • Inline
+ 18
18
@@ -355,7 +355,11 @@ export function networkReconfiguration(
@@ -355,7 +355,11 @@ export function networkReconfiguration(
) {
) {
async.waterfall(
async.waterfall(
[
[
upnpResolve.bind(null, noupnp, logger),
function (
 
next: (arg0: null, arg1: boolean, conf: NetworkConfDTO) => any
 
) {
 
return upnpResolve(!conf.upnp, logger, next);
 
},
function (upnpSuccess: boolean, upnpConf: NetworkConfDTO, next: any) {
function (upnpSuccess: boolean, upnpConf: NetworkConfDTO, next: any) {
// Default values
// Default values
conf.port = conf.port || BMAConstants.DEFAULT_PORT;
conf.port = conf.port || BMAConstants.DEFAULT_PORT;
@@ -470,20 +474,24 @@ export function networkReconfiguration(
@@ -470,20 +474,24 @@ export function networkReconfiguration(
async function upnpResolve(
async function upnpResolve(
noupnp: boolean,
noupnp: boolean,
logger: any,
logger: any,
done: (arg0: null, arg1: boolean, conf: Object) => any
next: (arg0: null, arg1: boolean, conf: Object) => any
) {
) {
try {
try {
let conf = await Network.upnpConf(noupnp, logger);
let conf = await Network.upnpConf(noupnp, logger);
done(null, true, conf);
next(null, true, conf);
} catch (err) {
} catch (err) {
done(null, false, {});
next(null, false, {});
}
}
}
}
function networkConfiguration(conf: NetworkConfDTO, logger: any, done: any) {
function networkConfiguration(conf: NetworkConfDTO, logger: any, done: any) {
async.waterfall(
async.waterfall(
[
[
upnpResolve.bind(null, !conf.upnp, logger),
function (
 
next: (arg0: null, arg1: boolean, conf: NetworkConfDTO) => any
 
) {
 
return upnpResolve(!conf.upnp, logger, next);
 
},
function (upnpSuccess: boolean, upnpConf: NetworkConfDTO, next: any) {
function (upnpSuccess: boolean, upnpConf: NetworkConfDTO, next: any) {
let operations = getLocalNetworkOperations(conf).concat(
let operations = getLocalNetworkOperations(conf).concat(
getRemoteNetworkOperations(conf, upnpConf.remoteipv4)
getRemoteNetworkOperations(conf, upnpConf.remoteipv4)
@@ -664,26 +672,18 @@ function getRemoteNetworkOperations(
@@ -664,26 +672,18 @@ function getRemoteNetworkOperations(
}
}
});
});
},
},
async function (answers: any, next: any) {
function (answers: any, next: any) {
conf.remoteipv4 = answers.remoteipv4;
conf.remoteipv4 = answers.remoteipv4;
try {
try {
if (conf.remoteipv4 || conf.remotehost) {
if (conf.remoteipv4 || conf.remotehost) {
await new Promise((resolve, reject) => {
simpleInteger("Remote port", "remoteport", conf, (err: any) => {
const getPort = async.apply(
if (err) throw err;
simpleInteger,
next();
"Remote port",
"remoteport",
conf
);
getPort((err: any) => {
if (err) return reject(err);
resolve();
});
});
});
} else if (conf.remoteipv6) {
} else if (conf.remoteipv6) {
conf.remoteport = conf.port;
conf.remoteport = conf.port;
 
next();
}
}
next();
} catch (e) {
} catch (e) {
next(e);
next(e);
}
}
Loading