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

wip

parent 68a2a865
No related branches found
No related tags found
1 merge request!2WIP: Old 4
...@@ -145,4 +145,8 @@ socket.on("message", function(message, rinfo) { ...@@ -145,4 +145,8 @@ socket.on("message", function(message, rinfo) {
machines = machines.filter(m => m.toString()[0] !== text[1]); machines = machines.filter(m => m.toString()[0] !== text[1]);
getPairings(machines); getPairings(machines);
} }
if (text[0] === "dead") {
console.log(text)
}
}); });
...@@ -118,21 +118,21 @@ function updateTimeStamp(ackMachineNumber) { ...@@ -118,21 +118,21 @@ function updateTimeStamp(ackMachineNumber) {
function updateStatuses() { function updateStatuses() {
Object.keys(connections).forEach(connection => { Object.keys(connections).forEach(connection => {
if (Date.now() - connections[connection].timestamp >= (2 * 10000)) { if (Date.now() - connections[connection].timestamp >= (5000)) {
connections[connection].status = "dead" connections[connection].status = "dead"
const message = Buffer.from(`dead ${connection}`); const message = Buffer.from(`dead ${connection}`);
console.log(message.toString()) console.log(message.toString())
console.log(Date.now() - connections[connection].timestamp) console.log(Date.now() - connections[connection].timestamp)
// socket.send( socket.send(
// message, message,
// 0, 0,
// message.length, message.length,
// PORT, PORT,
// machineToIps[machineNumberBeingChecked.toString()[0]], machineToIps["1"],
// function() {} function() {}
// ); );
} else { } else {
......
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