latest asyncmqttclient dev changes - to safeguard against stuck connections

This commit is contained in:
proddy
2021-07-21 16:25:42 +02:00
parent a95837404a
commit 2fda59d7db

View File

@@ -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);