Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs425-mp2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arshiam2
cs425-mp2
Commits
b3af779b
Commit
b3af779b
authored
6 years ago
by
arshiam2
Browse files
Options
Downloads
Patches
Plain Diff
command descriptions updated
parent
25b23b56
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
cli/src/commands/init.js
+1
-2
1 addition, 2 deletions
cli/src/commands/init.js
cli/src/commands/join.js
+1
-2
1 addition, 2 deletions
cli/src/commands/join.js
cli/src/commands/leave.js
+1
-2
1 addition, 2 deletions
cli/src/commands/leave.js
cli/src/commands/list.js
+2
-11
2 additions, 11 deletions
cli/src/commands/list.js
with
5 additions
and
17 deletions
cli/src/commands/init.js
+
1
−
2
View file @
b3af779b
...
@@ -5,12 +5,11 @@ const chalk = require("chalk");
...
@@ -5,12 +5,11 @@ const chalk = require("chalk");
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
module
.
exports
.
command
=
"
init
"
;
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
;
module
.
exports
.
builder
=
(
yargs
:
any
)
=>
yargs
;
const
PORT
=
20000
;
const
PORT
=
20000
;
const
MULTICAST_ADDR
=
"
233.255.255.255
"
;
const
HOST
=
"
172.22.156.15
"
;
const
HOST
=
"
172.22.156.15
"
;
const
dgram
=
require
(
"
dgram
"
);
const
dgram
=
require
(
"
dgram
"
);
...
...
This diff is collapsed.
Click to expand it.
cli/src/commands/join.js
+
1
−
2
View file @
b3af779b
...
@@ -5,12 +5,11 @@ const chalk = require("chalk");
...
@@ -5,12 +5,11 @@ const chalk = require("chalk");
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
module
.
exports
.
command
=
"
join [number]
"
;
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
;
module
.
exports
.
builder
=
(
yargs
:
any
)
=>
yargs
;
const
PORT
=
20000
;
const
PORT
=
20000
;
const
MULTICAST_ADDR
=
"
233.255.255.255
"
;
const
HOST
=
"
172.22.156.15
"
;
const
HOST
=
"
172.22.156.15
"
;
const
dgram
=
require
(
"
dgram
"
);
const
dgram
=
require
(
"
dgram
"
);
...
...
This diff is collapsed.
Click to expand it.
cli/src/commands/leave.js
+
1
−
2
View file @
b3af779b
...
@@ -5,7 +5,7 @@ const chalk = require("chalk");
...
@@ -5,7 +5,7 @@ const chalk = require("chalk");
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
module
.
exports
.
command
=
"
leave [number]
"
;
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
;
module
.
exports
.
builder
=
(
yargs
:
any
)
=>
yargs
;
...
@@ -21,7 +21,6 @@ const socket = dgram.createSocket({ type: "udp4", reuseAddr: true });
...
@@ -21,7 +21,6 @@ const socket = dgram.createSocket({ type: "udp4", reuseAddr: true });
socket
.
bind
(
PORT
);
socket
.
bind
(
PORT
);
function
sendMessage
(
number
)
{
function
sendMessage
(
number
)
{
// console.log(number)
const
message
=
Buffer
.
from
(
`leave
${
number
}
`
);
const
message
=
Buffer
.
from
(
`leave
${
number
}
`
);
socket
.
send
(
message
,
0
,
message
.
length
,
PORT
,
HOST
,
function
()
{});
socket
.
send
(
message
,
0
,
message
.
length
,
PORT
,
HOST
,
function
()
{});
}
}
...
...
This diff is collapsed.
Click to expand it.
cli/src/commands/list.js
+
2
−
11
View file @
b3af779b
...
@@ -5,14 +5,13 @@ const chalk = require("chalk");
...
@@ -5,14 +5,13 @@ const chalk = require("chalk");
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
module
.
exports
.
command
=
"
list [number]
"
;
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
;
module
.
exports
.
builder
=
(
yargs
:
any
)
=>
yargs
;
const
PORT
=
5000
;
const
PORT
=
5000
;
const
MULTICAST_ADDR
=
"
233.255.255.255
"
;
const
HOST
=
"
172.22.158.17
"
;
const
HOST
=
"
172.22.158.17
"
;
// const HOST = "fa18-cs425-g05-02.cs.illinois.edu";
const
dgram
=
require
(
"
dgram
"
);
const
dgram
=
require
(
"
dgram
"
);
const
process
=
require
(
"
process
"
);
const
process
=
require
(
"
process
"
);
...
@@ -35,9 +34,7 @@ const machineToIps = {
...
@@ -35,9 +34,7 @@ const machineToIps = {
socket
.
bind
(
PORT
);
socket
.
bind
(
PORT
);
socket
.
on
(
"
listening
"
,
function
()
{
socket
.
on
(
"
listening
"
,
function
()
{
socket
.
addMembership
(
MULTICAST_ADDR
);
socket
.
setBroadcast
(
true
);
socket
.
setBroadcast
(
true
);
// setInterval(sendMessage, 2500);
const
address
=
socket
.
address
();
const
address
=
socket
.
address
();
console
.
log
(
console
.
log
(
`UDP socket listening on
${
address
.
address
}
:
${
address
.
port
}
pid:
${
`UDP socket listening on
${
address
.
address
}
:
${
address
.
port
}
pid:
${
...
@@ -46,11 +43,6 @@ socket.on("listening", function() {
...
@@ -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
)
{
function
sendMessage
(
host
,
number
)
{
const
message
=
Buffer
.
from
(
`list`
);
const
message
=
Buffer
.
from
(
`list`
);
...
@@ -62,5 +54,4 @@ module.exports.handler = handleErrors(async (argv: {}) => {
...
@@ -62,5 +54,4 @@ module.exports.handler = handleErrors(async (argv: {}) => {
console
.
log
(
"
Sending message to introducer
"
);
console
.
log
(
"
Sending message to introducer
"
);
let
number
=
argv
.
number
;
let
number
=
argv
.
number
;
await
sendMessage
(
machineToIps
[
number
],
number
);
await
sendMessage
(
machineToIps
[
number
],
number
);
// process.exit(0);
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment