fix: Deliver publish verifies if message was created only for QoS >0

The previous version depends on a sucessful message being created prior
to that check. The check only makes sense for the case where puback or
pubrec messages should be created.
This commit is contained in:
Euripedes Rocha
2023-10-09 14:56:54 +02:00
committed by Rocha Euripedes
parent e6afdb4025
commit 67800569de

View File

@ -1348,6 +1348,7 @@ static esp_err_t mqtt_process_receive(esp_mqtt_client_handle_t client)
ESP_LOGE(TAG, "Failed to deliver publish message id=%d", msg_id);
return ESP_FAIL;
}
if (msg_qos == 1 || msg_qos == 2) {
if (msg_qos == 1) {
if (client->mqtt_state.connection.information.protocol_ver == MQTT_PROTOCOL_V_5) {
#ifdef MQTT_PROTOCOL_5
@ -1370,7 +1371,6 @@ static esp_err_t mqtt_process_receive(esp_mqtt_client_handle_t client)
return ESP_FAIL;
}
if (msg_qos == 1 || msg_qos == 2) {
ESP_LOGD(TAG, "Queue response QoS: %d", msg_qos);
if (esp_mqtt_write(client) != ESP_OK) {