From 888e315553dafef858996fa937db51a932fe7e84 Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Wed, 22 Sep 2021 10:37:46 +0200 Subject: [PATCH] Fix OTA crash during reading of new bin file. (#2366) Co-authored-by: Maurice Makaay --- esphome/components/ota/ota_component.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/ota/ota_component.cpp b/esphome/components/ota/ota_component.cpp index 5e07bb64e7..0c13efa135 100644 --- a/esphome/components/ota/ota_component.cpp +++ b/esphome/components/ota/ota_component.cpp @@ -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; }