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/04/05 01:44:33 UTC
[4/6] incubator-mynewt-newtmgr git commit: nmxact - Fix hang on some
ble_xport restarts.
nmxact - Fix hang on some ble_xport restarts.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/commit/2d55058f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/2d55058f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/2d55058f
Branch: refs/heads/master
Commit: 2d55058fe3ee691e69289c4d0eb8d4160feae800
Parents: 7dfbeb0
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Apr 4 18:05:59 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Apr 4 18:10:25 2017 -0700
----------------------------------------------------------------------
nmxact/nmble/ble_xport.go | 2 +-
nmxact/nmble/dispatch.go | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/2d55058f/nmxact/nmble/ble_xport.go
----------------------------------------------------------------------
diff --git a/nmxact/nmble/ble_xport.go b/nmxact/nmble/ble_xport.go
index 8a8b909..f957341 100644
--- a/nmxact/nmble/ble_xport.go
+++ b/nmxact/nmble/ble_xport.go
@@ -76,6 +76,7 @@ func NewBleXport(cfg XportCfg) (*BleXport, error) {
bx := &BleXport{
Bd: NewBleDispatcher(),
shutdownChan: make(chan bool),
+ readyChan: make(chan error),
cfg: cfg,
}
@@ -286,7 +287,6 @@ func (bx *BleXport) startOnce() error {
bx.stopChan = make(chan struct{})
bx.numStopListeners = 0
- bx.Bd.Clear()
bx.createUnixChild()
if err := bx.client.Start(); err != nil {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/2d55058f/nmxact/nmble/dispatch.go
----------------------------------------------------------------------
diff --git a/nmxact/nmble/dispatch.go b/nmxact/nmble/dispatch.go
index aba7504..583f3a4 100644
--- a/nmxact/nmble/dispatch.go
+++ b/nmxact/nmble/dispatch.go
@@ -292,6 +292,8 @@ func (bd *BleDispatcher) ErrorAll(err error) {
listeners = append(listeners, v)
}
+ bd.clear()
+
bd.mutex.Unlock()
for _, listener := range listeners {
@@ -299,10 +301,8 @@ func (bd *BleDispatcher) ErrorAll(err error) {
}
}
-func (bd *BleDispatcher) Clear() {
- bd.mutex.Lock()
- defer bd.mutex.Unlock()
-
+// The caller must lock the mutex.
+func (bd *BleDispatcher) clear() {
for s, _ := range bd.seqMap {
delete(bd.seqMap, s)
}