优化OTA下载流程,先关闭文件再执行callback,加快下载响应速度。
authorSnickerSun <snickersun@163.com>
Wed, 8 May 2024 13:35:08 +0000 (21:35 +0800)
committerSnickerSun <snickersun@163.com>
Wed, 8 May 2024 13:35:08 +0000 (21:35 +0800)
code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp
code/sdk/open_source/openharmony/third_party/lwip/src/apps/http/http_client.c

index 31ac4b0..4cd9299 100644 (file)
@@ -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)
         {
index 527c14b..2891ef1 100644 (file)
@@ -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);