Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setTimeout(() => {
// disconnect from all remote beacon
console.log();
for(var socketId in ipc.klyngRemote.of) {
ipc.klyngRemote.disconnect(socketId);
}
router.clear();
}, 1000);
}
setTimeout(() => {
// disconnect from all remote beacon
console.log();
for(var socketId in ipc.klyngRemote.of) {
ipc.klyngRemote.disconnect(socketId);
}
router.clear();
}, 1000);
}
var ipc = require('node-ipc');
var cs = require('./crypto-service');
var configs = require('./beacon-configs');
var router = require('./router');
var jobman = require('./job-manager');
var remoteIPC = new ipc.IPC();
configs.configureRemoteIPC(remoteIPC);
ipc.klyngRemote = remoteIPC;
/*
* connects to a remote beacon via ip:port
* @param ip {String}
* @param port {Number}
* @return {Promise}: promise of the connection to be made
*/
function connectTo(ip, port) {
return new Promise(function(resolve, reject) {
var id = "sock_" + ip + ":" + port;
remoteIPC.connectToNet(id, ip, port, function() {
remoteIPC.of[id].on('connect', function() {
resolve(remoteIPC.of[id]);
});