diff --git a/BSB_LAN/src/PubSubClient/src/PubSubClient.cpp b/BSB_LAN/src/PubSubClient/src/PubSubClient.cpp index 25e74257d..e8b5ed1c1 100644 --- a/BSB_LAN/src/PubSubClient/src/PubSubClient.cpp +++ b/BSB_LAN/src/PubSubClient/src/PubSubClient.cpp @@ -253,6 +253,7 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass write(MQTTCONNECT,this->buffer,length-MQTT_MAX_HEADER_SIZE); lastInActivity = lastOutActivity = millis(); + pingOutstanding = false; while (!_client->available()) { unsigned long t = millis(); @@ -374,6 +375,7 @@ boolean PubSubClient::loop() { if (pingOutstanding) { this->_state = MQTT_CONNECTION_TIMEOUT; _client->stop(); + pingOutstanding = false; return false; } else { this->buffer[0] = MQTTPINGREQ; @@ -665,6 +667,7 @@ void PubSubClient::disconnect() { _client->flush(); _client->stop(); lastInActivity = lastOutActivity = millis(); + pingOutstanding = false; } uint16_t PubSubClient::writeString(const char* string, uint8_t* buf, uint16_t pos) {