fix: Fix-Runde 3 für Task 4 - WLAN-Aussetzer bleibt resumable statt sofortigem Abbruch
This commit is contained in:
@@ -147,6 +147,20 @@ int http_fwup(HTTPParameters ClientParams)
|
||||
now_state = SHUTDOWN_LINK;
|
||||
break;
|
||||
}
|
||||
if (nSize == 0) {
|
||||
/* ninlight: a zero-length read is not a fwup rejection - it's what
|
||||
* HTTPClient.c's HTTPIntrnRecv()/nSocketEvents<0 paths report for a server
|
||||
* that closed mid-body or a transient socket hiccup (WLAN dropout), while
|
||||
* still returning HTTP_CLIENT_SUCCESS/HTTP_CLIENT_EOS. Passing an empty
|
||||
* packet into socket_fwup_recv() would turn it into the exact same ERR_ABRT
|
||||
* as a genuine checksum/trailer rejection (wm_socket_fwup.c: datalen==0 goes
|
||||
* to the same "goto err" as a failed tls_fwup_request_sync()) - the QUIT_OTA-
|
||||
* on-ERR_ABRT fix below must not see this case, or a routine WLAN dropout
|
||||
* would abort the update instead of resuming via SHUTDOWN_LINK/PREPARE_PACKET
|
||||
* like before. See sdk/PATCHES.md point 1 (Fix-Runde 3). */
|
||||
now_state = SHUTDOWN_LINK;
|
||||
break;
|
||||
}
|
||||
#if USE_BREAK_POINT_RESUME == 0
|
||||
if(breakFlag == 1){
|
||||
breakLen += nSize;
|
||||
@@ -181,15 +195,19 @@ int http_fwup(HTTPParameters ClientParams)
|
||||
// Send received data to fwup thread and deal with socket issues.
|
||||
s8 ret = socket_fwup_recv(0, p, ERR_OK);
|
||||
if(ret != ERR_OK){
|
||||
/* ninlight: socket_fwup_recv() rejected this chunk (the fwup task hit a
|
||||
* checksum/trailer mismatch or another fatal error, see wm_fwup.c) - recvLen
|
||||
* never advances past this point, so going through SHUTDOWN_LINK used to start
|
||||
* a full Range-resume retry (up to NL_OTA_MAX_RETRY_ROUNDS rounds) whose data
|
||||
* the fwup task would just keep discarding. Bail out to QUIT_OTA directly so
|
||||
* the caller gets the real error immediately instead of after minutes. Force
|
||||
* nRetCode nonzero so the socket_fwup_err() cleanup below still runs. See
|
||||
* sdk/PATCHES.md point 1. */
|
||||
nRetCode = ret;
|
||||
/* ninlight: nSize > 0 is guaranteed here (see the nSize==0 check above), so
|
||||
* this ERR_ABRT is NOT the "empty packet" case - it means
|
||||
* wm_socket_fwup.c's socket_fwup_recv() actually rejected non-empty data:
|
||||
* either tls_fwup_enter() refused the session (e.g. still busy from a
|
||||
* previous attempt) on the first chunk, or tls_fwup_request_sync() reported a
|
||||
* checksum/trailer/hash mismatch on a later one (see wm_fwup.c). Either way
|
||||
* recvLen never advances past this point, so going through SHUTDOWN_LINK used
|
||||
* to start a full Range-resume retry (up to NL_OTA_MAX_RETRY_ROUNDS rounds)
|
||||
* whose data the fwup task would just keep discarding. Bail out to QUIT_OTA
|
||||
* directly so the caller gets the real error immediately instead of after
|
||||
* minutes. Force nRetCode nonzero so the socket_fwup_err() cleanup below
|
||||
* still runs. See sdk/PATCHES.md point 1. */
|
||||
nRetCode = HTTP_CLIENT_ERROR_BAD_STATE;
|
||||
now_state = QUIT_OTA;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user