esp_https_ota.c: Add errno check for WiFi disconnection while performing OTA

This commit is contained in:
Shubham Kulkarni 2020-02-19 16:23:56 +05:30 committed by maojianxin
parent bc881cc32d
commit 50ea32b86d

View File

@ -238,7 +238,7 @@ esp_err_t esp_https_ota_get_img_desc(esp_https_ota_handle_t https_ota_handle, es
* As esp_http_client_read never returns negative error code, we rely on
* `errno` to check for underlying transport connectivity closure if any
*/
if (errno == ENOTCONN || errno == ECONNRESET) {
if (errno == ENOTCONN || errno == ECONNRESET || errno == ECONNABORTED) {
ESP_LOGE(TAG, "Connection closed, errno = %d", errno);
break;
}
@ -300,7 +300,7 @@ esp_err_t esp_https_ota_perform(esp_https_ota_handle_t https_ota_handle)
* an ENOTCONN or ECONNRESET, failure is returned. We close with success
* if complete data has been received.
*/
if ((errno == ENOTCONN || errno == ECONNRESET) && !is_recv_complete) {
if ((errno == ENOTCONN || errno == ECONNRESET || errno == ECONNABORTED) && !is_recv_complete) {
ESP_LOGE(TAG, "Connection closed, errno = %d", errno);
return ESP_FAIL;
} else if (!is_recv_complete) {