From b3af779b17ef30f7924484d4b1617206f76ff8f1 Mon Sep 17 00:00:00 2001
From: arshiam2 <arshiam2@illinois.edu>
Date: Sun, 7 Oct 2018 23:06:41 -0500
Subject: [PATCH] command descriptions updated

---
 cli/src/commands/init.js  |  3 +--
 cli/src/commands/join.js  |  3 +--
 cli/src/commands/leave.js |  3 +--
 cli/src/commands/list.js  | 13 ++-----------
 4 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/cli/src/commands/init.js b/cli/src/commands/init.js
index ed67286..7cdefa6 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 9ecab1e..2401a60 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 79054bb..dd2db85 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 3837d99..da2bb6d 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);
 });
-- 
GitLab