mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject incubator-mynewt-newtmgr git commit: nmxact - Fix deadlock on redundant BLE Open().
Date Tue, 09 May 2017 23:43:11 GMT
Repository: incubator-mynewt-newtmgr
Updated Branches:
  refs/heads/master 739d29c45 -> d8f913e74


nmxact - Fix deadlock on redundant BLE Open().

The BLE session would block forever if the client attempted to start it
twice.  Now, an error is returned instead.


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/d8f913e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/d8f913e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/d8f913e7

Branch: refs/heads/master
Commit: d8f913e7496d753378d573db0655fe8a43a77c74
Parents: 739d29c
Author: Christopher Collins <ccollins@apache.org>
Authored: Tue May 9 16:41:28 2017 -0700
Committer: Christopher Collins <ccollins@apache.org>
Committed: Tue May 9 16:42:31 2017 -0700

----------------------------------------------------------------------
 nmxact/example/ble_dual/ble_dual.go | 6 +++---
 nmxact/nmble/ble_fsm.go             | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d8f913e7/nmxact/example/ble_dual/ble_dual.go
----------------------------------------------------------------------
diff --git a/nmxact/example/ble_dual/ble_dual.go b/nmxact/example/ble_dual/ble_dual.go
index b1e2a67..5be14e5 100644
--- a/nmxact/example/ble_dual/ble_dual.go
+++ b/nmxact/example/ble_dual/ble_dual.go
@@ -189,7 +189,7 @@ func main() {
 	params := nmble.NewXportCfg()
 	params.SockPath = "/tmp/blehostd-uds"
 	params.BlehostdPath = "blehostd.elf"
-	params.DevPath = "/dev/cu.usbmodem14221"
+	params.DevPath = "/dev/cu.usbmodem142121"
 
 	x, err := nmble.NewBleXport(params)
 	if err != nil {
@@ -210,8 +210,8 @@ func main() {
 
 	peerNames := []string{
 		"ccollins1",
-		"ccollins2",
-		"ccollins3",
+		//"ccollins2",
+		//"ccollins3",
 	}
 
 	sesns := []sesn.Sesn{}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d8f913e7/nmxact/nmble/ble_fsm.go
----------------------------------------------------------------------
diff --git a/nmxact/nmble/ble_fsm.go b/nmxact/nmble/ble_fsm.go
index 05c18ba..03d70f7 100644
--- a/nmxact/nmble/ble_fsm.go
+++ b/nmxact/nmble/ble_fsm.go
@@ -275,6 +275,7 @@ func (bf *BleFsm) processErr(err error) {
 
 	bf.peerDev = nil
 
+	// Wait for all listeners to get removed.
 	bf.wg.Wait()
 
 	bf.errFunnel.Reset()
@@ -776,15 +777,14 @@ func (bf *BleFsm) executeState() (bool, error) {
 }
 
 func (bf *BleFsm) startOnce() (bool, error) {
-	bf.errFunnel.Start()
-
 	if !bf.IsClosed() {
-		bf.errFunnel.Reset()
 		return false, nmxutil.NewSesnAlreadyOpenError(fmt.Sprintf(
 			"Attempt to open an already-open BLE session (state=%d)",
 			bf.getState()))
 	}
 
+	bf.errFunnel.Start()
+
 	for {
 		retry, err := bf.executeState()
 		if err != nil {


Mime
View raw message