fix crash when using encrypted connection
This commit is contained in:
@@ -264,7 +264,7 @@ bool Network::reconnect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool connected = _device->mqttConnected();
|
bool connected = _device->mqttConnected();
|
||||||
unsigned long timeout = millis() + 5000;
|
unsigned long timeout = millis() + 3000;
|
||||||
|
|
||||||
while(!connected && millis() < timeout)
|
while(!connected && millis() < timeout)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ WifiDevice::WifiDevice(const String& hostname, Preferences* _preferences)
|
|||||||
size_t crtLength = _preferences->getString(preference_mqtt_crt,_cert,TLS_CERT_MAX_SIZE);
|
size_t crtLength = _preferences->getString(preference_mqtt_crt,_cert,TLS_CERT_MAX_SIZE);
|
||||||
size_t keyLength = _preferences->getString(preference_mqtt_key,_key,TLS_KEY_MAX_SIZE);
|
size_t keyLength = _preferences->getString(preference_mqtt_key,_key,TLS_KEY_MAX_SIZE);
|
||||||
|
|
||||||
_useEncryption = caLength > 1;
|
_useEncryption = caLength > 1; // length is 1 when empty
|
||||||
|
|
||||||
if(_useEncryption > 1) // length is 1 when empty
|
if(_useEncryption)
|
||||||
{
|
{
|
||||||
Log->println(F("MQTT over TLS."));
|
Log->println(F("MQTT over TLS."));
|
||||||
Log->println(_ca);
|
Log->println(_ca);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ private:
|
|||||||
char* _path;
|
char* _path;
|
||||||
bool _useEncryption = false;
|
bool _useEncryption = false;
|
||||||
|
|
||||||
char _ca[TLS_CA_MAX_SIZE];
|
char _ca[TLS_CA_MAX_SIZE] = {0};
|
||||||
char _cert[TLS_CERT_MAX_SIZE];
|
char _cert[TLS_CERT_MAX_SIZE] = {0};
|
||||||
char _key[TLS_KEY_MAX_SIZE];
|
char _key[TLS_KEY_MAX_SIZE] = {0};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user