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
This commit is contained in:
Euripedes Rocha
2022-10-26 13:09:01 +02:00
parent 64cd608307
commit af58f5f2e5

View File

@ -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);
}