diff --git a/cli/src/commands/init.js b/cli/src/commands/init.js index ed67286ed64e8923f6627235dd41c4b418e4ba84..7cdefa6c3b07cd7807aedf6332c33b290f1f0f9d 100644 --- a/cli/src/commands/init.js +++ b/cli/src/commands/init.js @@ -5,12 +5,11 @@ const chalk = require("chalk"); const handleErrors = require("../utils/handleErrors"); module.exports.command = "init"; -module.exports.describe = "test commands"; +module.exports.describe = "Sets up five nodes (VMs 2 through 6) in a group, with VM 1 as the introducer."; module.exports.builder = (yargs: any) => yargs; const PORT = 20000; -const MULTICAST_ADDR = "233.255.255.255"; const HOST = "172.22.156.15"; const dgram = require("dgram"); diff --git a/cli/src/commands/join.js b/cli/src/commands/join.js index 9ecab1e9ffa3122cab28e1094e60e72092b52aa5..2401a60c1d02d58f39052ed8e565c9d4070172b3 100644 --- a/cli/src/commands/join.js +++ b/cli/src/commands/join.js @@ -5,12 +5,11 @@ const chalk = require("chalk"); const handleErrors = require("../utils/handleErrors"); module.exports.command = "join [number]"; -module.exports.describe = "test commands"; +module.exports.describe = "Adds the specified VM to the group"; module.exports.builder = (yargs: any) => yargs; const PORT = 20000; -const MULTICAST_ADDR = "233.255.255.255"; const HOST = "172.22.156.15"; const dgram = require("dgram"); diff --git a/cli/src/commands/leave.js b/cli/src/commands/leave.js index 79054bb2d89ca60c85ce81c7ff25fef32148d915..dd2db85f106f6425c2e53b46d498e48444d2456a 100644 --- a/cli/src/commands/leave.js +++ b/cli/src/commands/leave.js @@ -5,7 +5,7 @@ const chalk = require("chalk"); const handleErrors = require("../utils/handleErrors"); module.exports.command = "leave [number]"; -module.exports.describe = "test commands"; +module.exports.describe = "Voluntarily removal of the specified VM from group"; module.exports.builder = (yargs: any) => yargs; @@ -21,7 +21,6 @@ const socket = dgram.createSocket({ type: "udp4", reuseAddr: true }); socket.bind(PORT); function sendMessage(number) { - // console.log(number) const message = Buffer.from(`leave ${number}`); socket.send(message, 0, message.length, PORT, HOST, function() {}); } diff --git a/cli/src/commands/list.js b/cli/src/commands/list.js index 3837d991b063a0e5cfbca0643b67f49383a0d5b6..da2bb6d1700dfb60a5f03569b21c75bbfa478e50 100644 --- a/cli/src/commands/list.js +++ b/cli/src/commands/list.js @@ -5,14 +5,13 @@ const chalk = require("chalk"); const handleErrors = require("../utils/handleErrors"); module.exports.command = "list [number]"; -module.exports.describe = "test commands"; +module.exports.describe = "Lists the membership list local the specified VM."; module.exports.builder = (yargs: any) => yargs; const PORT = 5000; -const MULTICAST_ADDR = "233.255.255.255"; const HOST = "172.22.158.17"; -// const HOST = "fa18-cs425-g05-02.cs.illinois.edu"; + const dgram = require("dgram"); const process = require("process"); @@ -35,9 +34,7 @@ const machineToIps = { socket.bind(PORT); socket.on("listening", function() { - socket.addMembership(MULTICAST_ADDR); socket.setBroadcast(true); - // setInterval(sendMessage, 2500); const address = socket.address(); console.log( `UDP socket listening on ${address.address}:${address.port} pid: ${ @@ -46,11 +43,6 @@ socket.on("listening", function() { ); }); -socket.on("message", function(message, rinfo) { - console.log("GOT message") -// const parsedMessage = JSON.parse(message); -// Object.keys(JSON.parse(message)).map(key => console.log(key + " " + parsedMessage[key]["status"])) -}); function sendMessage(host, number) { const message = Buffer.from(`list`); @@ -62,5 +54,4 @@ module.exports.handler = handleErrors(async (argv: {}) => { console.log("Sending message to introducer"); let number = argv.number; await sendMessage(machineToIps[number], number); - // process.exit(0); });