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 02:04:32 UTC
[mynewt-newtmgr] branch master updated: nmxact - Don't stop
listening for OMP on disc.
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
The following commit(s) were added to refs/heads/master by this push:
new d989b1e nmxact - Don't stop listening for OMP on disc.
d989b1e is described below
commit d989b1e1ffd0d1143aacf15de04541a2c39320fb
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Jul 11 18:55:03 2017 -0700
nmxact - Don't stop listening for OMP on disc.
Rather than stop the OMP listener on disconnect, stop it on session
close. This fixes the issue that occurs when a BLE session lives on
after a disconnect, i.e., when a connection retry occurs due to MTU
exchange timeout.
There are a lot of synchronization issues here. It is probably time for
a large round of cleanup and "refactoring" (aka rewriting).
---
nmxact/nmble/ble_oic_sesn.go | 2 ++
nmxact/nmserial/serial_oic_sesn.go | 3 +++
nmxact/omp/dispatch.go | 16 ++++++++++++----
nmxact/udp/udp_oic_sesn.go | 1 +
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/nmxact/nmble/ble_oic_sesn.go b/nmxact/nmble/ble_oic_sesn.go
index ec866fb..57551bc 100644
--- a/nmxact/nmble/ble_oic_sesn.go
+++ b/nmxact/nmble/ble_oic_sesn.go
@@ -164,6 +164,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/nmxact/nmserial/serial_oic_sesn.go b/nmxact/nmserial/serial_oic_sesn.go
index d63b71b..ce46371 100644
--- a/nmxact/nmserial/serial_oic_sesn.go
+++ b/nmxact/nmserial/serial_oic_sesn.go
@@ -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/nmxact/omp/dispatch.go b/nmxact/omp/dispatch.go
index 17740f6..30b04ea 100644
--- a/nmxact/omp/dispatch.go
+++ b/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/nmxact/udp/udp_oic_sesn.go b/nmxact/udp/udp_oic_sesn.go
index 28c6fa5..1e840c2 100644
--- a/nmxact/udp/udp_oic_sesn.go
+++ b/nmxact/udp/udp_oic_sesn.go
@@ -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>'].