fix: abgewiesener fw_update verdirbt last_ota_error des laufenden Updates nicht mehr
Ein zweiter fw_update waehrend eines laufenden Downloads setzte s_error auf "busy". Da ota_task() nur bei leerem Fehlerfeld auf "download" zurueckfaellt, wurde ein spaeter gescheiterter Transfer danach als "busy" gemeldet statt als "download". Die Abweisung hat kein eigenes Ergebnis - sie wird der API mit 409 gemeldet, last_ota_error bleibt beim Ergebnis des laufenden bzw. letzten Updates. Dazu die Doku auf das am EVK gemessene Verhalten korrigiert: stirbt die Gegenstelle mitten im Download, haengt der Lesevorgang rund sieben Minuten in einem TCP-Timeout und bricht ohne Range-Resume ab. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
6adf22fb52
commit
5e2dff375e
+3
-3
@@ -339,9 +339,9 @@ static void handle_command(const nl_api_ctx_t *ctx, const nl_http_request_t *req
|
||||
else if (ctx->fw_update(url) != 0) {
|
||||
/* fw_update() itself can genuinely fail now (busy, or a rejected URL) - 409 with the
|
||||
* reason, not a blanket "not implemented". */
|
||||
nl_sys_info_t in;
|
||||
ctx->get_info(&in);
|
||||
reply_error(resp, 409, in.last_ota_error ? in.last_ota_error : "fw_update busy or invalid url");
|
||||
/* Do not reuse last_ota_error for this message: it belongs to the running or last
|
||||
* update, not to the request we are rejecting right now. */
|
||||
reply_error(resp, 409, "an update is already running");
|
||||
} else
|
||||
reply(resp, 202, "{\"status\":\"updating\"}");
|
||||
} else if (strcmp(type, "reboot") == 0) {
|
||||
|
||||
+6
-1
@@ -115,7 +115,12 @@ static int ota_start(const char *url, bool reject_running_version)
|
||||
if (n <= 7 || n >= sizeof s_url) /* n == 7 is bare "http://" with no host */
|
||||
return -1;
|
||||
if (s_busy) {
|
||||
s_error = "busy";
|
||||
/* Do NOT touch s_error here. last_ota_error describes the outcome of the *running or last*
|
||||
* update; a request we reject because one is already in flight has no outcome of its own.
|
||||
* Writing "busy" into it used to poison the running attempt's slot: ota_task() only falls
|
||||
* back to "download" when s_error is still NULL, so a failed transfer was afterwards
|
||||
* reported as `busy` instead of `download`. Found on the EVK, 2026-09-12. The REST layer
|
||||
* reports the rejection to its own caller with 409. */
|
||||
return -1;
|
||||
}
|
||||
s_busy = true;
|
||||
|
||||
Reference in New Issue
Block a user