mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-09-25 06:31:34 +02:00
Merge branch 'fix_destroy' into 'master'
fix: Allow mqtt client to gracefully disconnect when stop See merge request espressif/esp-mqtt!249
This commit is contained in:
@@ -1942,10 +1942,7 @@ esp_err_t esp_mqtt_client_stop(esp_mqtt_client_handle_t client)
|
|||||||
|
|
||||||
// Only send the disconnect message if the client is connected
|
// Only send the disconnect message if the client is connected
|
||||||
if (client->state == MQTT_STATE_CONNECTED) {
|
if (client->state == MQTT_STATE_CONNECTED) {
|
||||||
if (send_disconnect_msg(client) != ESP_OK) {
|
send_disconnect_msg(client);
|
||||||
MQTT_API_UNLOCK(client);
|
|
||||||
return ESP_FAIL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client->run = false;
|
client->run = false;
|
||||||
|
Reference in New Issue
Block a user