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 2016/11/10 22:38:26 UTC

[14/50] incubator-mynewt-newt git commit: newtmgr; filter out echoed requests when doing oic over serial.

newtmgr; filter out echoed requests when doing oic over serial.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/afae040c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/afae040c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/afae040c

Branch: refs/heads/master
Commit: afae040cdffb632b34b422ec7d2f4a04c9ab5f62
Parents: 2ac611b
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Oct 26 16:21:27 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Oct 26 16:21:27 2016 -0700

----------------------------------------------------------------------
 newtmgr/protocol/cmdrunner.go | 3 +++
 newtmgr/protocol/omgr.go      | 3 +++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/afae040c/newtmgr/protocol/cmdrunner.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/cmdrunner.go b/newtmgr/protocol/cmdrunner.go
index 7ec3d56..0c2a151 100644
--- a/newtmgr/protocol/cmdrunner.go
+++ b/newtmgr/protocol/cmdrunner.go
@@ -51,6 +51,9 @@ func (cr *CmdRunner) ReadResp() (*NmgrReq, error) {
 		if err != nil {
 			return nil, err
 		}
+		if nmrfrag == nil {
+			continue
+		}
 		if nmrfrag.Op == NMGR_OP_READ_RSP || nmrfrag.Op == NMGR_OP_WRITE_RSP {
 			nmr.Data = append(nmr.Data, nmrfrag.Data...)
 			nmr.Len += nmrfrag.Len

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/afae040c/newtmgr/protocol/omgr.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/omgr.go b/newtmgr/protocol/omgr.go
index 29bff4c..b417546 100644
--- a/newtmgr/protocol/omgr.go
+++ b/newtmgr/protocol/omgr.go
@@ -46,6 +46,9 @@ func DeserializeOmgrReq(data []byte) (*NmgrReq, error) {
 		return nil, util.NewNewtError(fmt.Sprintf(
 			"Oicmgr request invalid %s", err.Error()))
 	}
+	if req.Code == coap.GET || req.Code == coap.PUT {
+		return nil, nil
+	}
 	if req.Code != coap.Created && req.Code != coap.Deleted &&
 		req.Code != coap.Valid && req.Code != coap.Changed &&
 		req.Code != coap.Content {