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/09/21 01:47:28 UTC

[mynewt-newtmgr] 03/03: nmxact - discoverer stop rxing stop on close.

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 54e52e25b3e5a06649cc4499d9839eb0658018a7
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Sep 20 18:46:49 2017 -0700

    nmxact - discoverer stop rxing stop on close.
---
 nmxact/nmble/discover.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/nmxact/nmble/discover.go b/nmxact/nmble/discover.go
index 13220e8..1658cdc 100644
--- a/nmxact/nmble/discover.go
+++ b/nmxact/nmble/discover.go
@@ -120,6 +120,8 @@ func (d *Discoverer) Start() (<-chan BleAdvReport, <-chan error, error) {
 	go func() {
 		defer d.wg.Done()
 
+		stopChan := d.stopChan
+
 		// Block until scan completes.
 		var done bool
 		var err error
@@ -128,12 +130,13 @@ func (d *Discoverer) Start() (<-chan BleAdvReport, <-chan error, error) {
 			case err = <-ech:
 				done = true
 
-			case <-d.stopChan:
+			case <-stopChan:
 				// Discovery aborted; remove the BLE listener.  This will cause
 				// the scan to fail, triggering a send on the ech channel.
 				if bl != nil {
 					d.params.Bx.RemoveListener(bl)
 					bl = nil
+					stopChan = nil
 				}
 			}
 		}
@@ -161,6 +164,7 @@ func (d *Discoverer) Start() (<-chan BleAdvReport, <-chan error, error) {
 	}()
 
 	d.setState(DISCOVERER_STATE_STARTED)
+
 	return ach, parentEch, nil
 }
 

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