From af58f5f2e5691cdf6729b17402376794832df56e Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Wed, 26 Oct 2022 13:09:01 +0200 Subject: [PATCH] Moves state change when stopping the client - In some situations client could be left in a state where it's impossible to restart due to a state change while waiting for the stop. This guarantee that it's possible to start after calling stop. Closes https://github.com/espressif/esp-mqtt/issues/239 --- mqtt_client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mqtt_client.c b/mqtt_client.c index a589f626..ea981fff 100644 --- a/mqtt_client.c +++ b/mqtt_client.c @@ -1546,6 +1546,7 @@ 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; vTaskDelete(NULL); }