OTA: don't abort a download on a momentary connected()==false
A forced reinstall aborted at 570 B when the TLS client briefly reported disconnected between records; the retry went through. A drop now only counts after 2 s without data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -315,7 +315,11 @@ static bool writeImage(const manifest_t& m, const esp_partition_t* part) {
|
||||
while (ok && got < m.size) {
|
||||
size_t avail = stream->available();
|
||||
if (avail == 0) {
|
||||
if (!http.connected() || millis() - last_rx > STALL_TIMEOUT_MS) {
|
||||
// connected() can read false for a moment between TLS records, so a
|
||||
// drop only counts after 2 s of silence (it aborted a download at
|
||||
// 570 B once, 2026-09-26; the retry went through).
|
||||
uint32_t idle = millis() - last_rx;
|
||||
if ((!http.connected() && idle > 2000) || idle > STALL_TIMEOUT_MS) {
|
||||
print("[ota] download stalled at %lu/%lu bytes", (unsigned long)got, (unsigned long)m.size);
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user