You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/11/23 07:29:39 UTC

[GitHub] sjanc closed pull request #17: Fix missing upload events callbacks

sjanc closed pull request #17: Fix missing upload events callbacks
URL: https://github.com/apache/mynewt-mcumgr/pull/17
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/cmd/img_mgmt/src/img_mgmt.c b/cmd/img_mgmt/src/img_mgmt.c
index bc25d13..02e717b 100644
--- a/cmd/img_mgmt/src/img_mgmt.c
+++ b/cmd/img_mgmt/src/img_mgmt.c
@@ -406,6 +406,8 @@ img_mgmt_upload(struct mgmt_ctxt *ctxt)
             return MGMT_ERR_EINVAL;
         }
 
+        cmd_status_arg.status = IMG_MGMT_ID_UPLOAD_STATUS_START;
+
         /*
          * If request includes proper data hash we can check whether there is
          * upload in progress (interrupted due to e.g. link disconnection) with
@@ -415,7 +417,7 @@ img_mgmt_upload(struct mgmt_ctxt *ctxt)
          if ((data_sha_len > 0) && img_mgmt_ctxt.uploading) {
             if ((img_mgmt_ctxt.data_sha_len == data_sha_len) &&
                     !memcmp(img_mgmt_ctxt.data_sha, data_sha, data_sha_len)) {
-                return img_mgmt_encode_upload_rsp(ctxt, 0);
+                goto done;
             }
         }
 
@@ -425,8 +427,6 @@ img_mgmt_upload(struct mgmt_ctxt *ctxt)
             return rc;
         }
         img_mgmt_ctxt.len = len;
-
-        cmd_status_arg.status = IMG_MGMT_ID_UPLOAD_STATUS_START;
     } else {
         if (!img_mgmt_ctxt.uploading) {
             return MGMT_ERR_EINVAL;
@@ -436,7 +436,7 @@ img_mgmt_upload(struct mgmt_ctxt *ctxt)
 
         if (off != img_mgmt_ctxt.off) {
             /* Invalid offset.  Drop the data and send the expected offset. */
-            return img_mgmt_encode_upload_rsp(ctxt, 0);
+            goto done;
         }
     }
 
@@ -463,6 +463,7 @@ img_mgmt_upload(struct mgmt_ctxt *ctxt)
         cmd_status_arg.status = IMG_MGMT_ID_UPLOAD_STATUS_COMPLETE;
     }
 
+done:
     mgmt_evt(MGMT_EVT_OP_CMD_STATUS, MGMT_GROUP_ID_IMAGE, IMG_MGMT_ID_UPLOAD,
              &cmd_status_arg);
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services