fix: Error on publish message creation was ignored.

In the case of make_publish failure the client would just continue and
the error was ignored and not propagated to caller.
This commit is contained in:
Euripedes Rocha
2023-06-27 15:13:54 +02:00
parent effd1e6705
commit 585e3ba2e0

View File

@ -999,7 +999,7 @@ static esp_err_t esp_mqtt_dispatch_event(esp_mqtt_client_handle_t client)
client->event.protocol_ver = client->mqtt_state.connection.information.protocol_ver;
esp_err_t ret = ESP_FAIL;
#ifdef MQTT_SUPPORTED_FEATURE_EVENT_LOOP
#ifdef MQTT_SUPPORTED_FEATURE_EVENT_LOOP
esp_event_post_to(client->config->event_loop_handle, MQTT_EVENTS, client->event.event_id, &client->event, sizeof(client->event), portMAX_DELAY);
ret = esp_event_loop_run(client->config->event_loop_handle, 0);
#else
@ -1976,6 +1976,9 @@ static inline int mqtt_client_enqueue_publish(esp_mqtt_client_handle_t client, c
int len, int qos, int retain, bool store)
{
int pending_msg_id = make_publish(client, topic, data, len, qos, retain);
if (pending_msg_id < 0) {
return -1;
}
/* We have to set as pending all the qos>0 messages */
//TODO: client->mqtt_state.outbound_message = publish_msg;
if (qos > 0 || store) {