From 96545c6c5df9ef37769c387640d24f850c3f98ed Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 7 Jan 2021 00:11:02 -0800 Subject: [PATCH] Intel AMT manager fixes. --- amt/amt-wsman-comm.js | 6 +++--- amtmanager.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/amt/amt-wsman-comm.js b/amt/amt-wsman-comm.js index cf19b100..2c43a0e9 100644 --- a/amt/amt-wsman-comm.js +++ b/amt/amt-wsman-comm.js @@ -249,7 +249,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn obj.socket = obj.tls.connect(obj.port, obj.host, options, obj.xxOnSocketConnected); obj.socket.setEncoding('binary'); - obj.socket.setTimeout(6000); // Set socket idle timeout + obj.socket.setTimeout(60000); // Set socket idle timeout obj.socket.on('error', function (ex) { obj.xtlsMethod = 1 - obj.xtlsMethod; }); obj.socket.on('close', obj.xxOnSocketClosed); obj.socket.on('timeout', obj.xxOnSocketTimeout); @@ -269,7 +269,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn // Direct connect without TLS obj.socket = new obj.net.Socket(); obj.socket.setEncoding('binary'); - obj.socket.setTimeout(6000); // Set socket idle timeout + obj.socket.setTimeout(60000); // Set socket idle timeout obj.socket.on('data', obj.xxOnSocketData); obj.socket.on('close', obj.xxOnSocketClosed); obj.socket.on('timeout', obj.xxOnSocketTimeout); @@ -286,7 +286,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn } obj.socket = obj.tls.connect(obj.port, obj.host, options, obj.xxOnSocketConnected); obj.socket.setEncoding('binary'); - obj.socket.setTimeout(6000); // Set socket idle timeout + obj.socket.setTimeout(60000); // Set socket idle timeout obj.socket.on('data', obj.xxOnSocketData); obj.socket.on('close', obj.xxOnSocketClosed); obj.socket.on('timeout', obj.xxOnSocketTimeout); diff --git a/amtmanager.js b/amtmanager.js index 70c72f71..e24d8458 100644 --- a/amtmanager.js +++ b/amtmanager.js @@ -115,6 +115,8 @@ module.exports.CreateAmtManager = function (parent) { // Remove an Intel AMT managed device function removeAmtDevice(dev) { + parent.debug('amt', "Remove device", dev.nodeid, dev.connType); + // Find the device in the list var devices = obj.amtDevices[dev.nodeid]; if (devices == null) return false; @@ -133,12 +135,14 @@ module.exports.CreateAmtManager = function (parent) { if (devices.length == 0) { delete obj.amtDevices[dev.nodeid]; } else { obj.amtDevices[dev.nodeid] = devices; } // Notify connection closure if this is a LMS connection - if (dev.connType == 2) { dev.controlMsg({ action: "close" }); } + if (dev.connType == 2) { dev.controlMsg({ action: 'close' }); } return true; } // Remove all Intel AMT devices for a given nodeid function removeDevice(nodeid) { + parent.debug('amt', "Remove nodeid", nodeid); + // Find the devices in the list var devices = obj.amtDevices[nodeid]; if (devices == null) return false; @@ -152,9 +156,12 @@ module.exports.CreateAmtManager = function (parent) { // Clean up this device if (dev.amtstack != null) { dev.amtstack.wsman.comm.FailAllError = 999; delete dev.amtstack; } // Disconnect any active connections. if (dev.polltimer != null) { clearInterval(dev.polltimer); delete dev.polltimer; } + + // Notify connection closure if this is a LMS connection + if (dev.connType == 2) { dev.controlMsg({ action: 'close' }); } } - // Remove all devices + // Remove all Intel AMT management sessions for this nodeid delete obj.amtDevices[nodeid]; return true; }