Skip to content

fix(esp_http_client): fix spurious async open error (IDFGH-15429) #16076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/esp_http_client/esp_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1722,11 +1722,17 @@ esp_err_t esp_http_client_open(esp_http_client_handle_t client, int write_len)
client->post_len = write_len;
esp_err_t err;
if ((err = esp_http_client_connect(client)) != ESP_OK) {
if (client->is_async && err == ESP_ERR_HTTP_CONNECTING) {
return ESP_ERR_HTTP_EAGAIN;
}
http_dispatch_event(client, HTTP_EVENT_ERROR, esp_transport_get_error_handle(client->transport), 0);
http_dispatch_event_to_event_loop(HTTP_EVENT_ERROR, &client, sizeof(esp_http_client_handle_t));
return err;
}
if ((err = esp_http_client_request_send(client, write_len)) != ESP_OK) {
if (client->is_async && errno == EAGAIN) {
return ESP_ERR_HTTP_EAGAIN;
}
http_dispatch_event(client, HTTP_EVENT_ERROR, esp_transport_get_error_handle(client->transport), 0);
http_dispatch_event_to_event_loop(HTTP_EVENT_ERROR, &client, sizeof(esp_http_client_handle_t));
return err;
Expand Down