Feed watchdog while setting up OTA (#2876)

This commit is contained in:
Carlos Garcia Saura 2021-12-06 23:26:06 +01:00 committed by GitHub
parent 5404617d43
commit e5cc19de43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -372,6 +372,7 @@ bool OTAComponent::readall_(uint8_t *buf, size_t len) {
ssize_t read = this->client_->read(buf + at, len - at);
if (read == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
App.feed_wdt();
delay(1);
continue;
}
@ -383,6 +384,7 @@ bool OTAComponent::readall_(uint8_t *buf, size_t len) {
} else {
at += read;
}
App.feed_wdt();
delay(1);
}
@ -401,6 +403,7 @@ bool OTAComponent::writeall_(const uint8_t *buf, size_t len) {
ssize_t written = this->client_->write(buf + at, len - at);
if (written == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
App.feed_wdt();
delay(1);
continue;
}
@ -409,6 +412,7 @@ bool OTAComponent::writeall_(const uint8_t *buf, size_t len) {
} else {
at += written;
}
App.feed_wdt();
delay(1);
}
return true;