fix: Race condition when using destroy

In a case were destroy is being called by a higher priority task set the
STOPPED_BIT before seting the state would lead to a crash.
This commit is contained in:
Euripedes Rocha
2024-10-14 12:57:05 +02:00
parent 9de024ca53
commit 44292cc2c4

View File

@ -1763,8 +1763,8 @@ static void esp_mqtt_task(void *pv)
}
esp_transport_close(client->transport);
outbox_delete_all_items(client->outbox);
xEventGroupSetBits(client->status_bits, STOPPED_BIT);
client->state = MQTT_STATE_DISCONNECTED;
xEventGroupSetBits(client->status_bits, STOPPED_BIT);
vTaskDelete(NULL);
}