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);
ssize_t read = this->client_->read(buf, requested);
if (read == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK)
if (errno == EAGAIN || errno == EWOULDBLOCK) {
delay(1);
continue;
}
ESP_LOGW(TAG, "Error receiving data for update, errno: %d", errno);
goto error;
}