mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-29 18:28:24 +02:00
Merge branch 'bugfix/early_retransmit' into 'master'
Fix early retransmit See merge request espressif/esp-mqtt!44
This commit is contained in:
@ -45,6 +45,7 @@ esp_err_t outbox_delete_msgtype(outbox_handle_t outbox, int msg_type);
|
||||
int outbox_delete_expired(outbox_handle_t outbox, int current_tick, int timeout);
|
||||
|
||||
esp_err_t outbox_set_pending(outbox_handle_t outbox, int msg_id, pending_state_t pending);
|
||||
esp_err_t outbox_set_tick(outbox_handle_t outbox, int msg_id, int tick);
|
||||
int outbox_get_size(outbox_handle_t outbox);
|
||||
esp_err_t outbox_cleanup(outbox_handle_t outbox, int max_size);
|
||||
void outbox_destroy(outbox_handle_t outbox);
|
||||
|
@ -131,6 +131,16 @@ esp_err_t outbox_set_pending(outbox_handle_t outbox, int msg_id, pending_state_t
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t outbox_set_tick(outbox_handle_t outbox, int msg_id, int tick)
|
||||
{
|
||||
outbox_item_handle_t item = outbox_get(outbox, msg_id);
|
||||
if (item) {
|
||||
item->tick = tick;
|
||||
return ESP_OK;
|
||||
}
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t outbox_delete_msgtype(outbox_handle_t outbox, int msg_type)
|
||||
{
|
||||
outbox_item_handle_t item, tmp;
|
||||
|
@ -1355,7 +1355,9 @@ int esp_mqtt_client_publish(esp_mqtt_client_handle_t client, const char *topic,
|
||||
}
|
||||
}
|
||||
|
||||
if (qos > 0) {
|
||||
if (qos > 0) {
|
||||
//Tick is set after transmit to avoid retransmitting too early due slow network speed / big messages
|
||||
outbox_set_tick(client->outbox, pending_msg_id, platform_tick_get_ms());
|
||||
outbox_set_pending(client->outbox, pending_msg_id, TRANSMITTED);
|
||||
}
|
||||
MQTT_API_UNLOCK_FROM_OTHER_TASK(client);
|
||||
|
Reference in New Issue
Block a user