Skip to content

Commit

Permalink
Fix exception on MQTT ssl reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinroger committed Apr 2, 2016
1 parent aa03152 commit f23700a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Homie/MqttClient.cpp
Expand Up @@ -43,6 +43,9 @@ void MqttClientClass::setServer(const char* host, unsigned int port, const char*
}

bool MqttClientClass::connect(const char* clientId, const char* willMessage, unsigned char willQos, bool willRetain, bool auth, const char* username, const char* password) {
this->_wifiClient.stop(); // Ensure buffers are cleaned, otherwise exception
this->_wifiClientSecure.stop();

if (this->_secure && !(strcmp_P(this->_fingerprint, PSTR("")) == 0)) {
Logger.logln(F("Checking certificate"));
if (!this->_wifiClientSecure.connect(this->_host, this->_port)) {
Expand Down

0 comments on commit f23700a

Please sign in to comment.