Intel AMT manager fixes.

Ylian Saint-Hilaire committed Jan 7, 2021 at 00:11 UTC 96545c6c5df9ef37769c387640d24f850c3f98ed
2 files changed +12 -5
amt/amt-wsman-comm.js
+3 -3
@@ -249,7 +249,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn
249
250 obj.socket = obj.tls.connect(obj.port, obj.host, options, obj.xxOnSocketConnected);
251 obj.socket.setEncoding('binary');
252 - obj.socket.setTimeout(6000); // Set socket idle timeout
252 + obj.socket.setTimeout(60000); // Set socket idle timeout
253 obj.socket.on('error', function (ex) { obj.xtlsMethod = 1 - obj.xtlsMethod; });
254 obj.socket.on('close', obj.xxOnSocketClosed);
255 obj.socket.on('timeout', obj.xxOnSocketTimeout);
@@ -269,7 +269,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn
269 // Direct connect without TLS
270 obj.socket = new obj.net.Socket();
271 obj.socket.setEncoding('binary');
272 - obj.socket.setTimeout(6000); // Set socket idle timeout
272 + obj.socket.setTimeout(60000); // Set socket idle timeout
273 obj.socket.on('data', obj.xxOnSocketData);
274 obj.socket.on('close', obj.xxOnSocketClosed);
275 obj.socket.on('timeout', obj.xxOnSocketTimeout);
@@ -286,7 +286,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn
286 }
287 obj.socket = obj.tls.connect(obj.port, obj.host, options, obj.xxOnSocketConnected);
288 obj.socket.setEncoding('binary');
289 - obj.socket.setTimeout(6000); // Set socket idle timeout
289 + obj.socket.setTimeout(60000); // Set socket idle timeout
290 obj.socket.on('data', obj.xxOnSocketData);
291 obj.socket.on('close', obj.xxOnSocketClosed);
292 obj.socket.on('timeout', obj.xxOnSocketTimeout);
amtmanager.js
+9 -2
@@ -115,6 +115,8 @@ module.exports.CreateAmtManager = function (parent) {
115
116 // Remove an Intel AMT managed device
117 function removeAmtDevice(dev) {
118 + parent.debug('amt', "Remove device", dev.nodeid, dev.connType);
119 +
120 // Find the device in the list
121 var devices = obj.amtDevices[dev.nodeid];
122 if (devices == null) return false;
@@ -133,12 +135,14 @@ module.exports.CreateAmtManager = function (parent) {
135 if (devices.length == 0) { delete obj.amtDevices[dev.nodeid]; } else { obj.amtDevices[dev.nodeid] = devices; }
136
137 // Notify connection closure if this is a LMS connection
136 - if (dev.connType == 2) { dev.controlMsg({ action: "close" }); }
138 + if (dev.connType == 2) { dev.controlMsg({ action: 'close' }); }
139 return true;
140 }
141
142 // Remove all Intel AMT devices for a given nodeid
143 function removeDevice(nodeid) {
144 + parent.debug('amt', "Remove nodeid", nodeid);
145 +
146 // Find the devices in the list
147 var devices = obj.amtDevices[nodeid];
148 if (devices == null) return false;
@@ -152,9 +156,12 @@ module.exports.CreateAmtManager = function (parent) {
156 // Clean up this device
157 if (dev.amtstack != null) { dev.amtstack.wsman.comm.FailAllError = 999; delete dev.amtstack; } // Disconnect any active connections.
158 if (dev.polltimer != null) { clearInterval(dev.polltimer); delete dev.polltimer; }
159 +
160 + // Notify connection closure if this is a LMS connection
161 + if (dev.connType == 2) { dev.controlMsg({ action: 'close' }); }
162 }
163
157 - // Remove all devices
164 + // Remove all Intel AMT management sessions for this nodeid
165 delete obj.amtDevices[nodeid];
166 return true;
167 }