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 18:23:29 UTC

[mynewt-newtmgr] 02/02: newtmgr revendor

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 9d3945261b4a70efc4b385d09c389a4d57554f78
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Jul 12 10:55:56 2017 -0700

    newtmgr revendor
---
 newtmgr/Godeps/Godeps.json                         | 48 +++++++++++-----------
 .../newtmgr/nmxact/nmble/ble_oic_sesn.go           |  9 +++-
 .../newtmgr/nmxact/nmserial/serial_oic_sesn.go     |  5 ++-
 .../newtmgr/nmxact/omp/dispatch.go                 | 16 ++++++--
 .../newtmgr/nmxact/udp/udp_oic_sesn.go             |  3 +-
 5 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index 374bf44..bc53c6c 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-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmble",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmp",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmserial",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmxutil",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/oic",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/omp",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/scan",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/sesn",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/udp",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xact",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		},
 		{
 			"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xport",
-			"Comment": "mynewt_0_9_0_tag-534-gf1ab4dc",
-			"Rev": "f1ab4dc7840b0882fa7f89ad8920d4ce24c4cd1f"
+			"Comment": "mynewt_0_9_0_tag-537-gd6e274c",
+			"Rev": "d6e274c9556a3c8975348df34752f00ac9fa5e09"
 		}
 	]
 }
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 ec866fb..2c0281c 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
@@ -28,7 +28,6 @@ type BleOicSesn struct {
 
 func NewBleOicSesn(bx *BleXport, cfg sesn.SesnCfg) *BleOicSesn {
 	bos := &BleOicSesn{
-		d:            omp.NewDispatcher(true, 3),
 		closeTimeout: cfg.Ble.CloseTimeout,
 		onCloseCb:    cfg.OnCloseCb,
 	}
@@ -120,7 +119,11 @@ func (bos *BleOicSesn) AbortRx(seq uint8) error {
 }
 
 func (bos *BleOicSesn) Open() error {
-	return bos.bf.Start()
+	if err := bos.bf.Start(); err != nil {
+		return err
+	}
+	bos.d = omp.NewDispatcher(true, 3)
+	return nil
 }
 
 func (bos *BleOicSesn) Close() error {
@@ -164,6 +167,8 @@ 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
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 d63b71b..b37abc1 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
@@ -27,7 +27,6 @@ type SerialOicSesn struct {
 func NewSerialOicSesn(sx *SerialXport) *SerialOicSesn {
 	return &SerialOicSesn{
 		sx: sx,
-		d:  omp.NewDispatcher(false, 3),
 	}
 }
 
@@ -40,6 +39,7 @@ func (sos *SerialOicSesn) Open() error {
 			"Attempt to open an already-open serial session")
 	}
 
+	sos.d = omp.NewDispatcher(false, 3)
 	sos.isOpen = true
 	return nil
 }
@@ -52,7 +52,10 @@ func (sos *SerialOicSesn) Close() error {
 		return nmxutil.NewSesnClosedError(
 			"Attempt to close an unopened serial session")
 	}
+
+	sos.d.Stop()
 	sos.isOpen = false
+
 	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 17740f6..30b04ea 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/omp/dispatch.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/omp/dispatch.go
@@ -27,14 +27,16 @@ import (
 )
 
 type Dispatcher struct {
-	nmpd *nmp.Dispatcher
-	oicd *oic.Dispatcher
+	nmpd   *nmp.Dispatcher
+	oicd   *oic.Dispatcher
+	stopCh chan struct{}
 }
 
 func NewDispatcher(isTcp bool, logDepth int) *Dispatcher {
 	r := &Dispatcher{
-		nmpd: nmp.NewDispatcher(logDepth + 1),
-		oicd: oic.NewDispatcher(isTcp, logDepth+1),
+		nmpd:   nmp.NewDispatcher(logDepth + 1),
+		oicd:   oic.NewDispatcher(isTcp, logDepth+1),
+		stopCh: make(chan struct{}),
 	}
 
 	// Listen for OMP responses.  This should never fail.
@@ -68,6 +70,8 @@ func (r *Dispatcher) addOmpListener() error {
 
 			case err := <-ol.ErrChan:
 				log.Debugf("OIC error: %s", err.Error())
+
+			case <-r.stopCh:
 				return
 			}
 		}
@@ -76,6 +80,10 @@ func (r *Dispatcher) addOmpListener() error {
 	return nil
 }
 
+func (r *Dispatcher) Stop() {
+	r.stopCh <- struct{}{}
+}
+
 func (r *Dispatcher) Dispatch(data []byte) bool {
 	return r.oicd.Dispatch(data)
 }
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 28c6fa5..3eb4996 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
@@ -23,7 +23,6 @@ type UdpOicSesn struct {
 func NewUdpOicSesn(cfg sesn.SesnCfg) *UdpOicSesn {
 	uos := &UdpOicSesn{
 		cfg: cfg,
-		d:   omp.NewDispatcher(false, 3),
 	}
 
 	return uos
@@ -43,6 +42,7 @@ func (uos *UdpOicSesn) Open() error {
 		return err
 	}
 
+	uos.d = omp.NewDispatcher(false, 3)
 	uos.addr = addr
 	uos.conn = conn
 	return nil
@@ -55,6 +55,7 @@ func (uos *UdpOicSesn) Close() error {
 	}
 
 	uos.conn.Close()
+	uos.d.Stop()
 	uos.conn = nil
 	uos.addr = nil
 	return nil

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