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/07/12 19:21:20 UTC

[mynewt-newtmgr] branch master updated (f7e2c14 -> 2518ace)

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

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


    from f7e2c14  newtmgr revendor
     new d69cb76  nmxact - Don't stop the OIC dispatcher prematurely
     new 2518ace  newtmgr revendor

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 newtmgr/Godeps/Godeps.json                         | 48 +++++++++++-----------
 newtmgr/bll/bll_oic_sesn.go                        |  7 +++-
 .../newtmgr/nmxact/nmble/ble_oic_sesn.go           | 22 ++++++----
 .../newtmgr/nmxact/nmserial/serial_oic_sesn.go     |  6 ++-
 .../newtmgr/nmxact/omp/dispatch.go                 |  5 ++-
 .../newtmgr/nmxact/udp/udp_oic_sesn.go             |  6 ++-
 nmxact/nmble/ble_oic_sesn.go                       | 22 ++++++----
 nmxact/nmserial/serial_oic_sesn.go                 |  6 ++-
 nmxact/omp/dispatch.go                             |  5 ++-
 nmxact/udp/udp_oic_sesn.go                         |  6 ++-
 10 files changed, 86 insertions(+), 47 deletions(-)

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

[mynewt-newtmgr] 02/02: newtmgr revendor

Posted by cc...@apache.org.
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-newtmgr.git

commit 2518acea3aec912804b9a13f2c690f802999bb20
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Jul 12 12:01:27 2017 -0700

    newtmgr revendor
---
 newtmgr/Godeps/Godeps.json                         | 48 +++++++++++-----------
 .../newtmgr/nmxact/nmble/ble_oic_sesn.go           | 22 ++++++----
 .../newtmgr/nmxact/nmserial/serial_oic_sesn.go     |  6 ++-
 .../newtmgr/nmxact/omp/dispatch.go                 |  5 ++-
 .../newtmgr/nmxact/udp/udp_oic_sesn.go             |  6 ++-
 5 files changed, 52 insertions(+), 35 deletions(-)

diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index 6ecda87..0f2ac7e 100644
--- a/newtmgr/Godeps/Godeps.json
+++ b/newtmgr/Godeps/Godeps.json
@@ -126,63 +126,63 @@
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/bledefs",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmble",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmp",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmserial",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmxutil",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/oic",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/omp",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/scan",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/sesn",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/udp",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xact",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xport",
-			"Comment": "mynewt_0_9_0_tag-539-g372a3b4",
-			"Rev": "372a3b4a9cedb6355ae9b89a2ba2fea54ae537d2"
+			"Comment": "mynewt_0_9_0_tag-542-gfe87990",
+			"Rev": "fe87990877a516c6466009afb2da415f74c98f39"
 		}
 	]
 }
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_sesn.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_sesn.go
index b3a739c..2c4c6de 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_sesn.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_sesn.go
@@ -119,7 +119,12 @@ func (bos *BleOicSesn) AbortRx(seq uint8) error {
 }
 
 func (bos *BleOicSesn) Open() error {
-	bos.d = omp.NewDispatcher(true, 3)
+	d, err := omp.NewDispatcher(true, 3)
+	if err != nil {
+		return err
+	}
+	bos.d = d
+
 	if err := bos.bf.Start(); err != nil {
 		bos.d.Stop()
 		return err
@@ -168,14 +173,17 @@ func (bos *BleOicSesn) onDisconnect(dt BleFsmDisconnectType, peer BleDev,
 		bos.closeChan <- err
 	}
 
-	bos.d.Stop()
-
 	bos.mtx.Unlock()
 
-	// Only execute client's disconnect callback if the disconnect was
-	// unsolicited and the session was fully open.
-	if dt == FSM_DISCONNECT_TYPE_OPENED && bos.onCloseCb != nil {
-		bos.onCloseCb(bos, err)
+	// Only stop the dispatcher and execute client's disconnect callback if the
+	// disconnect was unsolicited and the session was fully open.  If the
+	// session wasn't fully open, the dispatcher will get stopped when the fsm
+	// start function returns an error (right after this function returns).
+	if dt == FSM_DISCONNECT_TYPE_OPENED {
+		bos.d.Stop()
+		if bos.onCloseCb != nil {
+			bos.onCloseCb(bos, err)
+		}
 	}
 }
 
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmserial/serial_oic_sesn.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmserial/serial_oic_sesn.go
index b37abc1..f3f3c85 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmserial/serial_oic_sesn.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmserial/serial_oic_sesn.go
@@ -39,7 +39,11 @@ func (sos *SerialOicSesn) Open() error {
 			"Attempt to open an already-open serial session")
 	}
 
-	sos.d = omp.NewDispatcher(false, 3)
+	d, err := omp.NewDispatcher(false, 3)
+	if err != nil {
+		return err
+	}
+	sos.d = d
 	sos.isOpen = true
 	return nil
 }
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/omp/dispatch.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/omp/dispatch.go
index 30b04ea..d0ba7d4 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/omp/dispatch.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/omp/dispatch.go
@@ -32,7 +32,7 @@ type Dispatcher struct {
 	stopCh chan struct{}
 }
 
-func NewDispatcher(isTcp bool, logDepth int) *Dispatcher {
+func NewDispatcher(isTcp bool, logDepth int) (*Dispatcher, error) {
 	r := &Dispatcher{
 		nmpd:   nmp.NewDispatcher(logDepth + 1),
 		oicd:   oic.NewDispatcher(isTcp, logDepth+1),
@@ -42,9 +42,10 @@ func NewDispatcher(isTcp bool, logDepth int) *Dispatcher {
 	// Listen for OMP responses.  This should never fail.
 	if err := r.addOmpListener(); err != nil {
 		log.Errorf("Unexpected failure to add OMP listener: " + err.Error())
+		return nil, err
 	}
 
-	return r
+	return r, nil
 }
 
 func (r *Dispatcher) addOmpListener() error {
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/udp/udp_oic_sesn.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/udp/udp_oic_sesn.go
index 3eb4996..abb0c66 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/udp/udp_oic_sesn.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/udp/udp_oic_sesn.go
@@ -42,7 +42,11 @@ func (uos *UdpOicSesn) Open() error {
 		return err
 	}
 
-	uos.d = omp.NewDispatcher(false, 3)
+	d, err := omp.NewDispatcher(false, 3)
+	if err != nil {
+		return err
+	}
+	uos.d = d
 	uos.addr = addr
 	uos.conn = conn
 	return nil

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

[mynewt-newtmgr] 01/02: nmxact - Don't stop the OIC dispatcher prematurely

Posted by cc...@apache.org.
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-newtmgr.git

commit d69cb76b00cf392bc6f2f66754b95f2beb9a5f7f
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Jul 12 12:18:02 2017 -0700

    nmxact - Don't stop the OIC dispatcher prematurely
---
 newtmgr/bll/bll_oic_sesn.go        |  7 ++++++-
 nmxact/nmble/ble_oic_sesn.go       | 22 +++++++++++++++-------
 nmxact/nmserial/serial_oic_sesn.go |  6 +++++-
 nmxact/omp/dispatch.go             |  5 +++--
 nmxact/udp/udp_oic_sesn.go         |  6 +++++-
 5 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/newtmgr/bll/bll_oic_sesn.go b/newtmgr/bll/bll_oic_sesn.go
index 990b39b..f94fdb0 100644
--- a/newtmgr/bll/bll_oic_sesn.go
+++ b/newtmgr/bll/bll_oic_sesn.go
@@ -40,6 +40,7 @@ func (bos *BllOicSesn) listenDisconnect() {
 
 		bos.mtx.Lock()
 		bos.d.ErrorAll(fmt.Errorf("Disconnected"))
+		bos.d.Stop()
 		bos.mtx.Unlock()
 
 		bos.cln = nil
@@ -141,7 +142,11 @@ func (bos *BllOicSesn) Open() error {
 			"Attempt to open an already-open bll session")
 	}
 
-	bos.d = omp.NewDispatcher(true, 3)
+	d, err := omp.NewDispatcher(true, 3)
+	if err != nil {
+		return err
+	}
+	bos.d = d
 
 	if err := bos.connect(); err != nil {
 		return err
diff --git a/nmxact/nmble/ble_oic_sesn.go b/nmxact/nmble/ble_oic_sesn.go
index b3a739c..2c4c6de 100644
--- a/nmxact/nmble/ble_oic_sesn.go
+++ b/nmxact/nmble/ble_oic_sesn.go
@@ -119,7 +119,12 @@ func (bos *BleOicSesn) AbortRx(seq uint8) error {
 }
 
 func (bos *BleOicSesn) Open() error {
-	bos.d = omp.NewDispatcher(true, 3)
+	d, err := omp.NewDispatcher(true, 3)
+	if err != nil {
+		return err
+	}
+	bos.d = d
+
 	if err := bos.bf.Start(); err != nil {
 		bos.d.Stop()
 		return err
@@ -168,14 +173,17 @@ func (bos *BleOicSesn) onDisconnect(dt BleFsmDisconnectType, peer BleDev,
 		bos.closeChan <- err
 	}
 
-	bos.d.Stop()
-
 	bos.mtx.Unlock()
 
-	// Only execute client's disconnect callback if the disconnect was
-	// unsolicited and the session was fully open.
-	if dt == FSM_DISCONNECT_TYPE_OPENED && bos.onCloseCb != nil {
-		bos.onCloseCb(bos, err)
+	// Only stop the dispatcher and execute client's disconnect callback if the
+	// disconnect was unsolicited and the session was fully open.  If the
+	// session wasn't fully open, the dispatcher will get stopped when the fsm
+	// start function returns an error (right after this function returns).
+	if dt == FSM_DISCONNECT_TYPE_OPENED {
+		bos.d.Stop()
+		if bos.onCloseCb != nil {
+			bos.onCloseCb(bos, err)
+		}
 	}
 }
 
diff --git a/nmxact/nmserial/serial_oic_sesn.go b/nmxact/nmserial/serial_oic_sesn.go
index b37abc1..f3f3c85 100644
--- a/nmxact/nmserial/serial_oic_sesn.go
+++ b/nmxact/nmserial/serial_oic_sesn.go
@@ -39,7 +39,11 @@ func (sos *SerialOicSesn) Open() error {
 			"Attempt to open an already-open serial session")
 	}
 
-	sos.d = omp.NewDispatcher(false, 3)
+	d, err := omp.NewDispatcher(false, 3)
+	if err != nil {
+		return err
+	}
+	sos.d = d
 	sos.isOpen = true
 	return nil
 }
diff --git a/nmxact/omp/dispatch.go b/nmxact/omp/dispatch.go
index 30b04ea..d0ba7d4 100644
--- a/nmxact/omp/dispatch.go
+++ b/nmxact/omp/dispatch.go
@@ -32,7 +32,7 @@ type Dispatcher struct {
 	stopCh chan struct{}
 }
 
-func NewDispatcher(isTcp bool, logDepth int) *Dispatcher {
+func NewDispatcher(isTcp bool, logDepth int) (*Dispatcher, error) {
 	r := &Dispatcher{
 		nmpd:   nmp.NewDispatcher(logDepth + 1),
 		oicd:   oic.NewDispatcher(isTcp, logDepth+1),
@@ -42,9 +42,10 @@ func NewDispatcher(isTcp bool, logDepth int) *Dispatcher {
 	// Listen for OMP responses.  This should never fail.
 	if err := r.addOmpListener(); err != nil {
 		log.Errorf("Unexpected failure to add OMP listener: " + err.Error())
+		return nil, err
 	}
 
-	return r
+	return r, nil
 }
 
 func (r *Dispatcher) addOmpListener() error {
diff --git a/nmxact/udp/udp_oic_sesn.go b/nmxact/udp/udp_oic_sesn.go
index 3eb4996..abb0c66 100644
--- a/nmxact/udp/udp_oic_sesn.go
+++ b/nmxact/udp/udp_oic_sesn.go
@@ -42,7 +42,11 @@ func (uos *UdpOicSesn) Open() error {
 		return err
 	}
 
-	uos.d = omp.NewDispatcher(false, 3)
+	d, err := omp.NewDispatcher(false, 3)
+	if err != nil {
+		return err
+	}
+	uos.d = d
 	uos.addr = addr
 	uos.conn = conn
 	return nil

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