mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
Fix OTA crash during reading of new bin file. (#2366)
Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
This commit is contained in:
parent
11daabc9c2
commit
888e315553
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue