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 2017/10/27 16:38:05 UTC
[GitHub] mkiiskila closed pull request #44: Misc fixes
mkiiskila closed pull request #44: Misc fixes
URL: https://github.com/apache/mynewt-newtmgr/pull/44
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/newtmgr/cli/connprofile.go b/newtmgr/cli/connprofile.go
index 53cf6c9..0af32c2 100644
--- a/newtmgr/cli/connprofile.go
+++ b/newtmgr/cli/connprofile.go
@@ -64,10 +64,6 @@ func connProfileAddCmd(cmd *cobra.Command, args []string) {
nmUsage(cmd, util.NewNewtError("Must specify a connection type"))
}
- // Check that a connstring is specified.
- if len(cp.ConnString) == 0 {
- nmUsage(cmd, util.NewNewtError("Must specify a connection string"))
- }
if err := cpm.AddConnProfile(cp); err != nil {
nmUsage(cmd, err)
}
diff --git a/newtmgr/config/connprofile.go b/newtmgr/config/connprofile.go
index c6a34a5..0823d99 100644
--- a/newtmgr/config/connprofile.go
+++ b/newtmgr/config/connprofile.go
@@ -70,6 +70,7 @@ var connTypeNameMap = map[ConnType]string{
CONN_TYPE_BLE_OIC: "oic_bhd",
CONN_TYPE_UDP_PLAIN: "udp",
CONN_TYPE_UDP_OIC: "oic_udp",
+ CONN_TYPE_NONE: "???",
}
func ConnTypeToString(ct ConnType) string {
@@ -98,8 +99,10 @@ func (ct *ConnType) UnmarshalJSON(data []byte) error {
var err error
*ct, err = ConnTypeFromString(s)
-
- return err
+ if err != nil {
+ *ct = CONN_TYPE_NONE
+ }
+ return nil
}
func NewConnProfileMgr() (*ConnProfileMgr, error) {
diff --git a/nmxact/udp/udp.go b/nmxact/udp/udp.go
index cb7ea94..bd0f645 100644
--- a/nmxact/udp/udp.go
+++ b/nmxact/udp/udp.go
@@ -26,7 +26,7 @@ import (
log "github.com/Sirupsen/logrus"
)
-const MAX_PACKET_SIZE = 512
+const MAX_PACKET_SIZE = 2048
func Listen(peerString string, dispatchCb func(data []byte)) (
*net.UDPConn, *net.UDPAddr, error) {
diff --git a/nmxact/xact/image.go b/nmxact/xact/image.go
index 9d46f70..c924e96 100644
--- a/nmxact/xact/image.go
+++ b/nmxact/xact/image.go
@@ -32,6 +32,7 @@ import (
//////////////////////////////////////////////////////////////////////////////
// $upload //
//////////////////////////////////////////////////////////////////////////////
+const IMAGE_UPLOAD_MAX_CHUNK = 512
type ImageUploadProgressFn func(c *ImageUploadCmd, r *nmp.ImageUploadRsp)
type ImageUploadCmd struct {
@@ -99,6 +100,10 @@ func nextImageUploadReq(s sesn.Sesn, data []byte, off int) (
// Final chunk.
room = len(data) - off
}
+ // Cap the max amount of data sent
+ if room > IMAGE_UPLOAD_MAX_CHUNK {
+ room = IMAGE_UPLOAD_MAX_CHUNK
+ }
// Assume all the unused space can hold image data. This assumption may
// not be valid for some encodings (e.g., CBOR uses variable length fields
----------------------------------------------------------------
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