Fix OTA crash during reading of new bin file. (#2366)

Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
This commit is contained in:
Maurice Makaay 2021-09-22 10:37:46 +02:00 committed by GitHub
parent 11daabc9c2
commit 888e315553
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -388,8 +388,10 @@ void OTAComponent::handle_() {
size_t requested = std::min(sizeof(buf), ota_size - total); size_t requested = std::min(sizeof(buf), ota_size - total);
ssize_t read = this->client_->read(buf, requested); ssize_t read = this->client_->read(buf, requested);
if (read == -1) { if (read == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) if (errno == EAGAIN || errno == EWOULDBLOCK) {
delay(1);
continue; continue;
}
ESP_LOGW(TAG, "Error receiving data for update, errno: %d", errno); ESP_LOGW(TAG, "Error receiving data for update, errno: %d", errno);
goto error; goto error;
} }