本文主要是介绍ESP32-C3在MQTT访问时出现“transport_base: Poll timeout or error”问题的分析(9),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
接前一篇文章:ESP32-C3在MQTT访问时出现“transport_base: Poll timeout or error”问题的分析(8)
上一回解析了process_keepalive函数的第1步判断,本回继续解析该函数的其余内容。为了便于理解和回顾,再次贴出process_keepalive函数的源码,在components\components\mqtt\esp-mqtt\mqtt_client.c中,如下:
static esp_err_t process_keepalive(esp_mqtt_client_handle_t client)
{if (client->mqtt_state.connection.information.keepalive > 0) {const uint64_t keepalive_ms = client->mqtt_state.connection.information.keepalive * 1000;if (client->wait_for_ping_resp == true ) {if (has_timed_out(client->keepalive_tick, keepalive_ms)) {ESP_LOGE(TAG, "No PING_RESP, disconnected");esp_mqtt_abort_connection(client);
这篇关于ESP32-C3在MQTT访问时出现“transport_base: Poll timeout or error”问题的分析(9)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!