AMT manager improvements.

This commit is contained in:
Ylian Saint-Hilaire 2020-10-07 12:44:50 -07:00
parent 96f686133a
commit 9f8a5646ee
3 changed files with 20 additions and 15 deletions

View File

@ -40,7 +40,8 @@ module.exports.CreateAmtManager = function(parent) {
// Handle server events // Handle server events
obj.HandleEvent = function (source, event, ids, id) { obj.HandleEvent = function (source, event, ids, id) {
if (event.action != 'nodeconnect') return; // React to nodes connecting and disconnecting
if (event.action == 'nodeconnect') {
if ((event.conn & 14) != 0) { // connectType: Bitmask, 1 = MeshAgent, 2 = Intel AMT CIRA, 4 = Intel AMT local, 8 = Intel AMT Relay, 16 = MQTT if ((event.conn & 14) != 0) { // connectType: Bitmask, 1 = MeshAgent, 2 = Intel AMT CIRA, 4 = Intel AMT local, 8 = Intel AMT Relay, 16 = MQTT
// We have an OOB connection to Intel AMT, update our information // We have an OOB connection to Intel AMT, update our information
var dev = obj.amtDevices[event.nodeid]; var dev = obj.amtDevices[event.nodeid];
@ -56,6 +57,10 @@ module.exports.CreateAmtManager = function(parent) {
} }
} }
// React to node being removed
if (event.action == 'removenode') { removeDevice(event.nodeid); }
}
// Remove a device // Remove a device
function removeDevice(nodeid) { function removeDevice(nodeid) {
const dev = obj.amtDevices[nodeid]; const dev = obj.amtDevices[nodeid];

View File

@ -1472,7 +1472,7 @@
} }
case 'ifchange': { case 'ifchange': {
// Network interface changed for a device, if we are currently viewing this device, ask for an update. // Network interface changed for a device, if we are currently viewing this device, ask for an update.
if (currentNode._id == message.event.nodeid) { meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id }); } if ((currentNode != null) && (currentNode._id == message.event.nodeid)) { meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id }); }
break; break;
} }
case 'devicesessions': { case 'devicesessions': {

View File

@ -2955,7 +2955,7 @@
} }
case 'ifchange': { case 'ifchange': {
// Network interface changed for a device, if we are currently viewing this device, ask for an update. // Network interface changed for a device, if we are currently viewing this device, ask for an update.
if (currentNode._id == message.event.nodeid) { meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id }); } if ((currentNode != null) && (currentNode._id == message.event.nodeid)) { meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id }); }
break; break;
} }
case 'devicesessions': { case 'devicesessions': {