You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/12/14 01:50:28 UTC

[mynewt-mcumgr] 01/02: newtmgr - Don't include hdr len in len field.

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git

commit bce6547d713bd0dc2e5e133b9e313a11a8801cc6
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Dec 13 17:49:47 2017 -0800

    newtmgr - Don't include hdr len in len field.
---
 newtmgr/src/newtmgr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/newtmgr/src/newtmgr.c b/newtmgr/src/newtmgr.c
index 5266cd7..0bf5bcc 100644
--- a/newtmgr/src/newtmgr.c
+++ b/newtmgr/src/newtmgr.c
@@ -161,7 +161,8 @@ nmgr_build_err_rsp(struct nmgr_streamer *streamer,
         return rc;
     }
 
-    rsp_hdr.nh_len = htons(cbor_encode_bytes_written(&cbuf.encoder));
+    rsp_hdr.nh_len = cbor_encode_bytes_written(&cbuf.encoder) - NMGR_HDR_SIZE;
+    nmgr_hton_hdr(&rsp_hdr);
     rc = nmgr_write_hdr(streamer, &rsp_hdr);
     if (rc != 0) {
         return rc;
@@ -250,7 +251,7 @@ nmgr_handle_single_req(struct nmgr_streamer *streamer,
         return rc;
     }
 
-    rsp_hdr.nh_len = cbor_encode_bytes_written(&cbuf.encoder);
+    rsp_hdr.nh_len = cbor_encode_bytes_written(&cbuf.encoder) - NMGR_HDR_SIZE;
     nmgr_hton_hdr(&rsp_hdr);
     rc = nmgr_write_hdr(streamer, &rsp_hdr);
     if (rc != 0) {

-- 
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.