This commit is contained in:
Ylian Saint-Hilaire 2021-04-12 15:27:44 -07:00
parent 4883f5f26f
commit fd5eb3efca

View File

@ -452,7 +452,12 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn
//obj.Debug("xxOnSocketClosed"); //obj.Debug("xxOnSocketClosed");
obj.socketState = 0; obj.socketState = 0;
if (obj.socket != null) { if (obj.socket != null) {
if (obj.socket.removeAllListeners) { obj.socket.removeAllListeners(); } if (obj.socket.removeAllListeners) {
// Do not remove the error handler since it may still get triggered.
obj.socket.removeAllListeners('data');
obj.socket.removeAllListeners('close');
obj.socket.removeAllListeners('timeout');
}
try { try {
if (obj.mpsConnection == null) { if (obj.mpsConnection == null) {
obj.socket.destroy(); obj.socket.destroy();