Skip to content
Snippets Groups Projects
Commit afd611d6 authored by arshiam2's avatar arshiam2
Browse files

wip

parent 986e49bc
No related branches found
No related tags found
1 merge request!2WIP: Old 4
// @flow
const path = require("path");
const chalk = require("chalk");
const handleErrors = require("../utils/handleErrors");
module.exports.command = "whoami";
module.exports.describe = "test commands";
module.exports.builder = (yargs: any) => yargs;
const PORT = 20000;
const MULTICAST_ADDR = "233.255.255.255";
const HOST = "172.22.158.15";
const dgram = require("dgram");
const process = require("process");
const socket = dgram.createSocket({ type: "udp4", reuseAddr: true });
socket.bind(PORT);
function sendMessage() {
const message = Buffer.from(`cli ${process.pid}`);
socket.send(message, 0, message.length, PORT, HOST, function() {});
}
module.exports.handler = handleErrors(async (argv: {}) => {
console.log("Sending message to introducer")
await sendMessage();
process.exit(0);
});
......@@ -148,6 +148,7 @@ socket.on("message", function(message, rinfo) {
if (text[0] === "dead") {
console.log("Killed " + text[1].toString()[0])
const ondLength = machines.length
machines = machines.filter(m => m.toString()[0] !== text[1].toString()[0]);
getPairings(machines);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment