From dbedcf065d15f436d5e02b83375297c762f262eb Mon Sep 17 00:00:00 2001 From: Florian <1technophile@users.noreply.github.com> Date: Tue, 21 Sep 2021 17:43:18 -0500 Subject: [PATCH] Add mqtt_secure connection condition for logging (#1082) * Add mqtt_secure connection condition when logging SSL error status --- main/main.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/main.ino b/main/main.ino index 8b0324d..ee92423 100644 --- a/main/main.ino +++ b/main/main.ino @@ -530,9 +530,11 @@ void connectMQTT() { Log.warning(F("failure_number_mqtt: %d" CR), failure_number_mqtt); Log.warning(F("failed, rc=%d" CR), client.state()); #if defined(ESP32) - Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->lastError(nullptr, 0)); + if (mqtt_secure) + Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->lastError(nullptr, 0)); #elif defined(ESP8266) - Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->getLastSSLError()); + if (mqtt_secure) + Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->getLastSSLError()); #endif digitalWrite(LED_ERROR, LED_ERROR_ON); delay(2000);