From 88f4b8ed50af6989efba3f87a14882b276e2deb7 Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Fri, 4 Jun 2021 17:29:41 +0100 Subject: [PATCH] Reports config conflicts error to the user - Configuration conflicts were verified, logged but not reported to the user. --- include/mqtt_client.h | 1 + mqtt_client.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/mqtt_client.h b/include/mqtt_client.h index 348d072..5d8c8b3 100644 --- a/include/mqtt_client.h +++ b/include/mqtt_client.h @@ -375,6 +375,7 @@ esp_err_t esp_mqtt_client_destroy(esp_mqtt_client_handle_t client); * @param config mqtt configuration structure * * @return ESP_ERR_NO_MEM if failed to allocate + * ESP_ERR_INVALID_ARG if conflicts on transport configuration. * ESP_OK on success */ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_client_config_t *config); diff --git a/mqtt_client.c b/mqtt_client.c index 6c5b32e..698ae7c 100644 --- a/mqtt_client.c +++ b/mqtt_client.c @@ -536,11 +536,11 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl goto _mqtt_set_config_failed; } } - esp_mqtt_check_cfg_conflict(client->config, config); + esp_err_t config_has_conflict = esp_mqtt_check_cfg_conflict(client->config, config); MQTT_API_UNLOCK(client); - return ESP_OK; + return config_has_conflict; _mqtt_set_config_failed: esp_mqtt_destroy_config(client); MQTT_API_UNLOCK(client);