mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/esp_http_client_async_crash' into 'master'
esp_http_client: Fix crash in async mode See merge request idf/esp-idf!3551
This commit is contained in:
commit
ee0dea3d0d
@ -943,6 +943,10 @@ static esp_err_t esp_http_client_connect(esp_http_client_handle_t client)
|
||||
int ret = esp_transport_connect_async(client->transport, client->connection_info.host, client->connection_info.port, client->timeout_ms);
|
||||
if (ret == ASYNC_TRANS_CONNECT_FAIL) {
|
||||
ESP_LOGE(TAG, "Connection failed");
|
||||
if (strcasecmp(client->connection_info.scheme, "http") == 0) {
|
||||
ESP_LOGE(TAG, "Asynchronous mode doesn't work for HTTP based connection");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
return ESP_ERR_HTTP_CONNECT;
|
||||
} else if (ret == ASYNC_TRANS_CONNECTING) {
|
||||
ESP_LOGD(TAG, "Connection not yet established");
|
||||
|
@ -114,7 +114,7 @@ typedef struct {
|
||||
esp_http_client_transport_t transport_type; /*!< HTTP transport type, see `esp_http_client_transport_t` */
|
||||
int buffer_size; /*!< HTTP buffer size (both send and receive) */
|
||||
void *user_data; /*!< HTTP user_data context */
|
||||
bool is_async; /*!< Set asynchronous mode */
|
||||
bool is_async; /*!< Set asynchronous mode, only supported with HTTPS for now */
|
||||
} esp_http_client_config_t;
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@ int esp_transport_connect(esp_transport_handle_t t, const char *host, int port,
|
||||
int esp_transport_connect_async(esp_transport_handle_t t, const char *host, int port, int timeout_ms)
|
||||
{
|
||||
int ret = -1;
|
||||
if (t && t->_connect) {
|
||||
if (t && t->_connect_async) {
|
||||
return t->_connect_async(t, host, port, timeout_ms);
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user