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/23 18:51:29 UTC

[mynewt-newtmgr] 02/03: nxmact - Use specified random address.

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 bd6fcf5d441d3e040f8d5a4ef8da671652fd0a89
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Aug 23 11:48:05 2017 -0700

    nxmact - Use specified random address.
---
 nmxact/nmble/ble_xport.go | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/nmxact/nmble/ble_xport.go b/nmxact/nmble/ble_xport.go
index 9261d21..e6bd23a 100644
--- a/nmxact/nmble/ble_xport.go
+++ b/nmxact/nmble/ble_xport.go
@@ -110,7 +110,6 @@ type BleXport struct {
 	d               *Dispatcher
 	master          Master
 	mtx             sync.Mutex
-	randAddr        *BleAddr
 	readyBcast      nmxutil.Bcaster
 	scanner         *BleScanner
 	sesns           map[uint16]*BleSesn
@@ -445,18 +444,20 @@ func (bx *BleXport) startOnce() error {
 	}()
 
 	// Generate a new random address if none was specified.
-	if bx.randAddr == nil {
-		addr, err := GenRandAddrXact(bx)
+	var addr BleAddr
+	if bx.cfg.RandAddr != nil {
+		addr = *bx.cfg.RandAddr
+	} else {
+		var err error
+		addr, err = GenRandAddrXact(bx)
 		if err != nil {
 			bx.blockingShutdown(true, err)
 			return err
 		}
-
-		bx.randAddr = &addr
 	}
 
 	// Set the random address on the controller.
-	if err := SetRandAddrXact(bx, *bx.randAddr); err != nil {
+	if err := SetRandAddrXact(bx, addr); err != nil {
 		bx.blockingShutdown(true, err)
 		return err
 	}

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