From 845c2a3a1e112af5dbe5f3a9ee8f6adb92a03757 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 9 Nov 2020 16:04:27 +0800 Subject: [PATCH 1/3] mqtt: Fix missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path Fixes: 5e17dcaeb257 ("MQTT: Fix esp_mqtt_client_stop deadlock") Signed-off-by: Axel Lin --- mqtt_client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mqtt_client.c b/mqtt_client.c index fed7e7b..94c6158 100644 --- a/mqtt_client.c +++ b/mqtt_client.c @@ -1494,6 +1494,7 @@ esp_err_t esp_mqtt_client_stop(esp_mqtt_client_handle_t client) /* A running client cannot be stopped from the MQTT task/event handler */ TaskHandle_t running_task = xTaskGetCurrentTaskHandle(); if (running_task == client->task_handle) { + MQTT_API_UNLOCK(client); ESP_LOGE(TAG, "Client cannot be stopped from MQTT task"); return ESP_FAIL; } From 259baaec9671ea3c32afa3c27a1196fce5646974 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 9 Nov 2020 16:07:10 +0800 Subject: [PATCH 2/3] config: Fix typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS In esp-idf, it uses CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS rather than CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS. Signed-off-by: Axel Lin --- include/mqtt_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mqtt_config.h b/include/mqtt_config.h index e259a2a..d9b64c7 100644 --- a/include/mqtt_config.h +++ b/include/mqtt_config.h @@ -84,8 +84,8 @@ #endif #endif -#ifdef CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS -#define OUTBOX_EXPIRED_TIMEOUT_MS CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS +#ifdef CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS +#define OUTBOX_EXPIRED_TIMEOUT_MS CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS #else #define OUTBOX_EXPIRED_TIMEOUT_MS (30*1000) #endif From 673086e13a7ff141929ddc9739da3d197f8a5720 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 9 Nov 2020 16:08:22 +0800 Subject: [PATCH 3/3] mqtt_outbox: Remove unused retry_count field from outbox_item_t Signed-off-by: Axel Lin --- lib/mqtt_outbox.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/mqtt_outbox.c b/lib/mqtt_outbox.c index 4ba4b76..7409965 100644 --- a/lib/mqtt_outbox.c +++ b/lib/mqtt_outbox.c @@ -16,7 +16,6 @@ typedef struct outbox_item { int msg_type; int msg_qos; outbox_tick_t tick; - int retry_count; pending_state_t pending; STAILQ_ENTRY(outbox_item) next; } outbox_item_t;