From: SnickerSun Date: Wed, 8 May 2024 13:35:08 +0000 (+0800) Subject: 优化OTA下载流程,先关闭文件再执行callback,加快下载响应速度。 X-Git-Tag: release_V1.2.70_20241020_135402~1025^2~10^2~3 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=40107d3a8cdeb4d260d9aca5ad7fa6e2874f466f;p=mirrors%2FFD230.git 优化OTA下载流程,先关闭文件再执行callback,加快下载响应速度。 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp index 31ac4b0c0..4cd929972 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp @@ -182,7 +182,7 @@ namespace OHOS static void upgrade_task(void *arg) { - msleep(3000); + // msleep(3000); //uapi_tcxo_delay_ms(3000); @@ -289,7 +289,7 @@ namespace OHOS static void upgrade_task_fwpkg(void *arg) { - msleep(3000); + // msleep(3000); FILE * fp = fopen(Path_ota_package,"rb"); if(fp!=NULL) { diff --git a/code/sdk/open_source/openharmony/third_party/lwip/src/apps/http/http_client.c b/code/sdk/open_source/openharmony/third_party/lwip/src/apps/http/http_client.c index 527c14b82..2891ef1a9 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/src/apps/http/http_client.c +++ b/code/sdk/open_source/openharmony/third_party/lwip/src/apps/http/http_client.c @@ -821,10 +821,6 @@ static void httpc_fs_free(httpc_filestate_t *filestate) { if (filestate != NULL) { - if (filestate->file != NULL) { - fclose(filestate->file); - filestate->file = NULL; - } mem_free(filestate); } } @@ -836,6 +832,10 @@ httpc_fs_result(void *arg, httpc_result_t httpc_result, u32_t rx_content_len, { httpc_filestate_t *filestate = (httpc_filestate_t *)arg; if (filestate != NULL) { + if (filestate->file != NULL) { + fclose(filestate->file); + filestate->file = NULL; + } if (filestate->client_settings->result_fn != NULL) { filestate->client_settings->result_fn(filestate->callback_arg, httpc_result, rx_content_len, srv_res, err);