diff --git a/lib/async-mqtt-client/src/AsyncMqttClient.cpp b/lib/async-mqtt-client/src/AsyncMqttClient.cpp index bdaafcca2..68ea0c5fd 100644 --- a/lib/async-mqtt-client/src/AsyncMqttClient.cpp +++ b/lib/async-mqtt-client/src/AsyncMqttClient.cpp @@ -199,6 +199,8 @@ void AsyncMqttClient::_clear() { _clearQueue(true); // keep session data for now _parsingInformation.bufferState = AsyncMqttClientInternals::BufferState::NONE; + + _client.setRxTimeout(0); } /* TCP */ @@ -286,6 +288,7 @@ void AsyncMqttClient::_onData(char* data, size_t len) { case AsyncMqttClientInternals::PacketType.CONNACK: log_i("rcv CONNACK"); _currentParsedPacket = new AsyncMqttClientInternals::ConnAckPacket(&_parsingInformation, std::bind(&AsyncMqttClient::_onConnAck, this, std::placeholders::_1, std::placeholders::_2)); + _client.setRxTimeout(0); break; case AsyncMqttClientInternals::PacketType.PINGRESP: log_i("rcv PINGRESP"); @@ -708,6 +711,8 @@ void AsyncMqttClient::connect() { log_i("CONNECTING"); _state = CONNECTING; + _client.setRxTimeout(_keepAlive); + #if ASYNC_TCP_SSL_ENABLED if (_useIp) { _client.connect(_ip, _port, _secure);