Merge branch 'bugfix/deadlock_when_close' into 'master'

Bugfix/deadlock when close

See merge request espressif/esp-mqtt!36
This commit is contained in:
David Čermák
2019-08-08 18:12:17 +08:00

View File

@ -1168,9 +1168,9 @@ esp_err_t esp_mqtt_client_stop(esp_mqtt_client_handle_t client)
}
client->run = false;
xEventGroupWaitBits(client->status_bits, STOPPED_BIT, false, true, portMAX_DELAY);
client->state = MQTT_STATE_UNKNOWN;
MQTT_API_UNLOCK_FROM_OTHER_TASK(client);
xEventGroupWaitBits(client->status_bits, STOPPED_BIT, false, true, portMAX_DELAY);
return ESP_OK;
} else {
ESP_LOGW(TAG, "Client asked to stop, but was not started");