diff --git a/amtmanager.js b/amtmanager.js index d7fb5bbe..24e76e02 100644 --- a/amtmanager.js +++ b/amtmanager.js @@ -775,9 +775,12 @@ module.exports.CreateAmtManager = function (parent) { }); } else { // We got a bad response - if ((dev.conntype != 0) && (dev.tlsfail !== true) && (status == 408)) { // If not using CIRA and we get a 408 error while using TLS, try non-TLS. + if ((dev.connType != 0) && (dev.tlsfail !== false) && (status == 408)) { // If not using CIRA and we get a 408 error while using non-TLS, try TLS. + // non-TLS error on a local connection, try again with TLS + dev.tlsfail = false; dev.intelamt.tls = 1; attemptInitialContact(dev); return; + } else if ((dev.connType != 0) && (dev.tlsfail !== true) && (status == 408)) { // If not using CIRA and we get a 408 error while using TLS, try non-TLS. // TLS error on a local connection, try again without TLS - dev.tlsfail = true; attemptInitialContact(dev); return; + dev.tlsfail = true; dev.intelamt.tls = 0; attemptInitialContact(dev); return; } else if (status == 401) { // Authentication error, see if we can use alternative credentials if (dev.acctry != null) {