Intel AMT manager fixes.

This commit is contained in:
Ylian Saint-Hilaire 2021-01-07 00:11:02 -08:00
parent da1af63e2f
commit 96545c6c5d
2 changed files with 12 additions and 5 deletions

View File

@ -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);

View File

@ -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;
}