From 2fa945d0b8904f695a67dca527358f0833e11caf Mon Sep 17 00:00:00 2001 From: Rocha Euripedes Date: Thu, 2 Feb 2023 20:52:02 +0800 Subject: [PATCH] Adds Kconfig option to configure poll read timeout A new Kconfig option was added to allow users to configure poll read timeout. Closes: https://github.com/espressif/esp-mqtt/issues/245 --- Kconfig | 7 +++++++ lib/include/mqtt_config.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/Kconfig b/Kconfig index 113bac7..2c274ca 100644 --- a/Kconfig +++ b/Kconfig @@ -124,6 +124,13 @@ menu "ESP-MQTT Configurations" help MQTT task priority. Higher number denotes higher priority. + config MQTT_POLL_READ_TIMEOUT_MS + int "MQTT transport poll read timeut" + default 1000 + depends on MQTT_USE_CUSTOM_CONFIG + help + Timeout when polling underlying transport for read. + config MQTT_EVENT_QUEUE_SIZE int "Number of queued events." default 1 diff --git a/lib/include/mqtt_config.h b/lib/include/mqtt_config.h index e4b5ce5..6238ee1 100644 --- a/lib/include/mqtt_config.h +++ b/lib/include/mqtt_config.h @@ -17,7 +17,12 @@ #endif #define MQTT_RECON_DEFAULT_MS (10*1000) + +#ifdef CONFIG_MQTT_POLL_READ_TIMEOUT_MS +#define MQTT_POLL_READ_TIMEOUT_MS CONFIG_MQTT_POLL_READ_TIMEOUT_MS +#else #define MQTT_POLL_READ_TIMEOUT_MS (1000) +#endif #define MQTT_MSG_ID_INCREMENTAL CONFIG_MQTT_MSG_ID_INCREMENTAL