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:28 UTC

[mynewt-newtmgr] 01/02: nmxact - Rebuild dispatcher on sesn open.

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 103214fbece72a16504c3e0a80e67dd807176b11
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Jul 12 10:54:36 2017 -0700

    nmxact - Rebuild dispatcher on sesn open.
    
    Prior to this commit, the OIC dispatcher was getting built at
    sesn-construction-time.  This is a problem when a sesn gets reused
    (open, close, open), as the necessary listeners don't get re-added on
    subsequent opens.
---
 nmxact/nmble/ble_oic_sesn.go       | 7 +++++--
 nmxact/nmserial/serial_oic_sesn.go | 2 +-
 nmxact/udp/udp_oic_sesn.go         | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/nmxact/nmble/ble_oic_sesn.go b/nmxact/nmble/ble_oic_sesn.go
index 57551bc..2c0281c 100644
--- a/nmxact/nmble/ble_oic_sesn.go
+++ b/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 {
diff --git a/nmxact/nmserial/serial_oic_sesn.go b/nmxact/nmserial/serial_oic_sesn.go
index ce46371..b37abc1 100644
--- a/nmxact/nmserial/serial_oic_sesn.go
+++ b/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
 }
diff --git a/nmxact/udp/udp_oic_sesn.go b/nmxact/udp/udp_oic_sesn.go
index 1e840c2..3eb4996 100644
--- a/nmxact/udp/udp_oic_sesn.go
+++ b/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

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