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/08/29 22:55:36 UTC

[mynewt-newtmgr] branch master updated: nmxact - don't set rand-addr if sync fails.

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 2a9dfd2  nmxact - don't set rand-addr if sync fails.
2a9dfd2 is described below

commit 2a9dfd270a1ec1fce1104637faae96a1281748b4
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Aug 29 15:55:15 2017 -0700

    nmxact - don't set rand-addr if sync fails.
---
 nmxact/nmble/sync.go | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/nmxact/nmble/sync.go b/nmxact/nmble/sync.go
index a99e859..2a5b89b 100644
--- a/nmxact/nmble/sync.go
+++ b/nmxact/nmble/sync.go
@@ -40,6 +40,9 @@ func (s *Syncer) Refresh() (bool, error) {
 }
 
 func (s *Syncer) Synced() bool {
+	s.mtx.Lock()
+	defer s.mtx.Unlock()
+
 	return s.synced
 }
 
@@ -201,8 +204,15 @@ func (s *Syncer) Stop() error {
 func (s *Syncer) BlockUntilSynced(timeout time.Duration,
 	stopChan <-chan struct{}) error {
 
-	_, err := s.syncBlocker.Wait(timeout, stopChan)
-	return err
+	if _, err := s.syncBlocker.Wait(timeout, stopChan); err != nil {
+		return err
+	}
+
+	if !s.Synced() {
+		return fmt.Errorf("stopped")
+	}
+
+	return nil
 }
 
 func (s *Syncer) ListenSync() chan interface{} {

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