From b6fafa1956a56348528a6cb2d11adc27f18c744f Mon Sep 17 00:00:00 2001 From: arshiam2 <arshiam2@illinois.edu> Date: Sun, 7 Oct 2018 20:43:36 -0500 Subject: [PATCH] wip --- inroducer/index.js | 4 ++++ machine/index.js | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/inroducer/index.js b/inroducer/index.js index 4d9ce21..1e09e30 100644 --- a/inroducer/index.js +++ b/inroducer/index.js @@ -145,4 +145,8 @@ socket.on("message", function(message, rinfo) { machines = machines.filter(m => m.toString()[0] !== text[1]); getPairings(machines); } + + if (text[0] === "dead") { + console.log(text) + } }); diff --git a/machine/index.js b/machine/index.js index fb89e4a..e0e36bb 100644 --- a/machine/index.js +++ b/machine/index.js @@ -118,21 +118,21 @@ function updateTimeStamp(ackMachineNumber) { function updateStatuses() { Object.keys(connections).forEach(connection => { - if (Date.now() - connections[connection].timestamp >= (2 * 10000)) { + if (Date.now() - connections[connection].timestamp >= (5000)) { connections[connection].status = "dead" const message = Buffer.from(`dead ${connection}`); console.log(message.toString()) console.log(Date.now() - connections[connection].timestamp) - // socket.send( - // message, - // 0, - // message.length, - // PORT, - // machineToIps[machineNumberBeingChecked.toString()[0]], - // function() {} - // ); + socket.send( + message, + 0, + message.length, + PORT, + machineToIps["1"], + function() {} + ); } else { -- GitLab