Merge branch 'feature/set_config_error_reporting' into 'master'

Reports config conflicts error to the user

See merge request espressif/esp-mqtt!102
This commit is contained in:
David Čermák
2021-09-15 16:46:35 +00:00
2 changed files with 3 additions and 2 deletions

View File

@ -375,6 +375,7 @@ esp_err_t esp_mqtt_client_destroy(esp_mqtt_client_handle_t client);
* @param config mqtt configuration structure * @param config mqtt configuration structure
* *
* @return ESP_ERR_NO_MEM if failed to allocate * @return ESP_ERR_NO_MEM if failed to allocate
* ESP_ERR_INVALID_ARG if conflicts on transport configuration.
* ESP_OK on success * ESP_OK on success
*/ */
esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_client_config_t *config); esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_client_config_t *config);

View File

@ -550,11 +550,11 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl
goto _mqtt_set_config_failed; 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); MQTT_API_UNLOCK(client);
return ESP_OK; return config_has_conflict;
_mqtt_set_config_failed: _mqtt_set_config_failed:
esp_mqtt_destroy_config(client); esp_mqtt_destroy_config(client);
MQTT_API_UNLOCK(client); MQTT_API_UNLOCK(client);