fix: HTTP-Server-Heartbeat auch im Fehlerpfad ticken

Schlägt socket(), bind() oder listen() fehl, schlief die äußere Schleife eine
Sekunde und versuchte es erneut, ohne nl_http_beat zu erhöhen. Da app_task den
Watchdog nur füttert, wenn alle drei Heartbeats vorankommen, resettete der Chip
nach 20 s, bootete, scheiterte wieder - dauerhaft. Der Retry selbst ist die
Fehlerbehandlung, nicht der Reboot.
This commit is contained in:
Michael Sauer
2026-09-12 03:14:31 +02:00
parent cf1e6a351c
commit 8af58d0124
+5
View File
@@ -96,6 +96,11 @@ static void server_task(void *arg)
if (ls < 0 || bind(ls, (struct sockaddr *)&addr, sizeof addr) != 0 || listen(ls, 4) != 0) { if (ls < 0 || bind(ls, (struct sockaddr *)&addr, sizeof addr) != 0 || listen(ls, 4) != 0) {
if (ls >= 0) if (ls >= 0)
closesocket(ls); closesocket(ls);
/* I4: keep the heartbeat ticking while retrying. app_task only feeds the watchdog
* once all three heartbeats moved, so without this a failing socket()/bind()/listen()
* (e.g. no netif yet, or lwIP temporarily out of memory) would reset the chip after
* 20 s, boot, fail again - forever. The retry itself is the recovery, not a reboot. */
nl_http_beat++;
tls_os_time_delay(HZ); tls_os_time_delay(HZ);
continue; continue;
} }