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/21 18:10:11 UTC
[mynewt-newtmgr] branch master updated (badfa44 -> 3de01c1)
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git.
from badfa44 newtmgr - revendor
new b5708d0 nmxact - Fragment outgoing CoAP messages.
new 3de01c1 newtmgr - revendor
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
newtmgr/Godeps/Godeps.json | 74 +++++++++++-----------
.../github.com/runtimeco/go-coap/messagetcp.go | 2 +-
.../newtmgr/nmxact/nmble/ble_oic_svr.go | 21 +++++-
.../newtmgr/nmxact/nmble/ble_sesn.go | 8 +++
.../newtmgr/nmxact/nmble/ble_xport.go | 53 ++++++++++++----
nmxact/nmble/ble_oic_svr.go | 21 +++++-
nmxact/nmble/ble_sesn.go | 8 +++
nmxact/nmble/ble_xport.go | 53 ++++++++++++----
8 files changed, 174 insertions(+), 66 deletions(-)
--
To stop receiving notification emails like this one, please contact
['"commits@mynewt.apache.org" <co...@mynewt.apache.org>'].
[mynewt-newtmgr] 01/02: nmxact - Fragment outgoing CoAP messages.
Posted by cc...@apache.org.
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 b5708d015a401c4a145e0f90290b6ca8f18649d1
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Aug 21 11:05:25 2017 -0700
nmxact - Fragment outgoing CoAP messages.
---
nmxact/nmble/ble_oic_svr.go | 21 ++++++++++++++++--
nmxact/nmble/ble_sesn.go | 8 +++++++
nmxact/nmble/ble_xport.go | 53 +++++++++++++++++++++++++++++++++++----------
3 files changed, 68 insertions(+), 14 deletions(-)
diff --git a/nmxact/nmble/ble_oic_svr.go b/nmxact/nmble/ble_oic_svr.go
index b892d3d..6dc609f 100644
--- a/nmxact/nmble/ble_oic_svr.go
+++ b/nmxact/nmble/ble_oic_svr.go
@@ -41,6 +41,12 @@ func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
return 0
}
+ s := b.x.findSesn(access.ConnHandle)
+ if s == nil {
+ // The sender is no longer connected.
+ return ERR_CODE_ATT_UNLIKELY
+ }
+
data, err := ml.MarshalBinary()
if err != nil {
return ERR_CODE_ATT_UNLIKELY
@@ -51,8 +57,19 @@ func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
return ERR_CODE_ATT_UNLIKELY
}
- if err := NotifyXact(b.x, access.ConnHandle, valHandle, data); err != nil {
- return ERR_CODE_ATT_UNLIKELY
+ mtu := s.MtuOut()
+ for off := 0; off < len(data); off += mtu {
+ chunkEnd := off + mtu
+ if chunkEnd > len(data) {
+ chunkEnd = len(data)
+ }
+ chunk := data[off:chunkEnd]
+
+ if err := NotifyXact(b.x, access.ConnHandle, valHandle,
+ chunk); err != nil {
+
+ return ERR_CODE_ATT_UNLIKELY
+ }
}
return 0
diff --git a/nmxact/nmble/ble_sesn.go b/nmxact/nmble/ble_sesn.go
index 2355c30..705c76b 100644
--- a/nmxact/nmble/ble_sesn.go
+++ b/nmxact/nmble/ble_sesn.go
@@ -91,6 +91,8 @@ func (s *BleSesn) disconnectListen() {
// If the session is being closed, unblock the close() call.
defer s.closeBlocker.Unblock(nil)
+ s.bx.removeSesn(s.conn.connHandle)
+
// Block until disconnect.
err := <-s.conn.DisconnectChan()
nmxutil.Assert(!s.IsOpen())
@@ -251,6 +253,10 @@ func (s *BleSesn) Open() error {
}
}
+ if err != nil {
+ s.bx.addSesn(s.conn.connHandle, s)
+ }
+
return err
}
@@ -273,6 +279,8 @@ func (s *BleSesn) OpenConnected(
// Listen for incoming notifications in the background.
s.notifyListen()
+ s.bx.addSesn(connHandle, s)
+
return nil
}
diff --git a/nmxact/nmble/ble_xport.go b/nmxact/nmble/ble_xport.go
index 79a1f2c..03b158e 100644
--- a/nmxact/nmble/ble_xport.go
+++ b/nmxact/nmble/ble_xport.go
@@ -114,20 +114,22 @@ type BleXport struct {
master nmxutil.SingleResource
slave nmxutil.SingleResource
randAddr *BleAddr
- stateMtx sync.Mutex
+ mtx sync.Mutex
scanner *BleScanner
advertiser *Advertiser
cm ChrMgr
+ sesns map[uint16]*BleSesn
}
func NewBleXport(cfg XportCfg) (*BleXport, error) {
bx := &BleXport{
+ cfg: cfg,
d: NewDispatcher(),
shutdownChan: make(chan bool),
readyBcast: nmxutil.Bcaster{},
master: nmxutil.NewSingleResource(),
slave: nmxutil.NewSingleResource(),
- cfg: cfg,
+ sesns: map[uint16]*BleSesn{},
}
return bx, nil
@@ -258,7 +260,7 @@ func (bx *BleXport) shutdown(restart bool, err error) {
log.Debugf("Shutting down BLE transport")
- bx.stateMtx.Lock()
+ bx.mtx.Lock()
var fullyStarted bool
var already bool
@@ -278,13 +280,15 @@ func (bx *BleXport) shutdown(restart bool, err error) {
bx.state = BLE_XPORT_STATE_STOPPING
}
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
if already {
// Shutdown already in progress.
return
}
+ bx.sesns = map[uint16]*BleSesn{}
+
// Indicate error to all clients who are waiting for the master resource.
log.Debugf("Aborting BLE master")
bx.master.Abort(err)
@@ -321,22 +325,22 @@ func (bx *BleXport) shutdown(restart bool, err error) {
func (bx *BleXport) blockUntilReady() error {
var ch chan interface{}
- bx.stateMtx.Lock()
+ bx.mtx.Lock()
switch bx.state {
case BLE_XPORT_STATE_STARTED:
// Already started; don't block.
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
return nil
case BLE_XPORT_STATE_DORMANT:
// Not in the process of starting; the user will be waiting forever.
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
return fmt.Errorf("Attempt to use BLE transport without starting it")
default:
ch = bx.readyBcast.Listen()
}
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
itf := <-ch
if itf == nil {
@@ -347,15 +351,15 @@ func (bx *BleXport) blockUntilReady() error {
}
func (bx *BleXport) getState() BleXportState {
- bx.stateMtx.Lock()
- defer bx.stateMtx.Unlock()
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
return bx.state
}
func (bx *BleXport) setStateFrom(from BleXportState, to BleXportState) bool {
- bx.stateMtx.Lock()
- defer bx.stateMtx.Unlock()
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
if bx.state != from {
return false
@@ -659,3 +663,28 @@ func (bx *BleXport) ReleaseSlave() {
func (bx *BleXport) StopWaitingForSlave(token interface{}, err error) {
bx.slave.StopWaiting(token, err)
}
+
+func (bx *BleXport) addSesn(connHandle uint16, s *BleSesn) {
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
+
+ bx.sesns[connHandle] = s
+}
+
+func (bx *BleXport) removeSesn(connHandle uint16) *BleSesn {
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
+
+ s := bx.sesns[connHandle]
+ if s != nil {
+ delete(bx.sesns, connHandle)
+ }
+ return s
+}
+
+func (bx *BleXport) findSesn(connHandle uint16) *BleSesn {
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
+
+ return bx.sesns[connHandle]
+}
--
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.
[mynewt-newtmgr] 02/02: newtmgr - revendor
Posted by cc...@apache.org.
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 3de01c19666ce2a4ce5db00e13059bd71122fe2f
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Aug 21 10:52:04 2017 -0700
newtmgr - revendor
---
newtmgr/Godeps/Godeps.json | 74 +++++++++++-----------
.../github.com/runtimeco/go-coap/messagetcp.go | 2 +-
.../newtmgr/nmxact/nmble/ble_oic_svr.go | 21 +++++-
.../newtmgr/nmxact/nmble/ble_sesn.go | 8 +++
.../newtmgr/nmxact/nmble/ble_xport.go | 53 ++++++++++++----
5 files changed, 106 insertions(+), 52 deletions(-)
diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index bb0fef8..d458828 100644
--- a/newtmgr/Godeps/Godeps.json
+++ b/newtmgr/Godeps/Godeps.json
@@ -64,7 +64,7 @@
},
{
"ImportPath": "github.com/runtimeco/go-coap",
- "Rev": "00d0ad21a4e212b48744a8456e0203395aa42f21"
+ "Rev": "649f01f0fe93cfeca52e9c7b96f95eca0ca61a5f"
},
{
"ImportPath": "github.com/spf13/cast",
@@ -107,93 +107,93 @@
},
{
"ImportPath": "mynewt.apache.org/newt/util",
- "Comment": "mynewt_1_0_1_tag-32-g84f53dd",
- "Rev": "84f53dd6fa887471393d955a5f179c89c57c95b3"
+ "Comment": "mynewt_1_0_1_tag-36-g3e4cab9",
+ "Rev": "3e4cab989c9525e3445e9a802b051e07622195c2"
},
{
"ImportPath": "mynewt.apache.org/newt/util/unixchild",
- "Comment": "mynewt_1_0_1_tag-32-g84f53dd",
- "Rev": "84f53dd6fa887471393d955a5f179c89c57c95b3"
+ "Comment": "mynewt_1_0_1_tag-36-g3e4cab9",
+ "Rev": "3e4cab989c9525e3445e9a802b051e07622195c2"
},
{
"ImportPath": "mynewt.apache.org/newt/viper",
- "Comment": "mynewt_1_0_1_tag-32-g84f53dd",
- "Rev": "84f53dd6fa887471393d955a5f179c89c57c95b3"
+ "Comment": "mynewt_1_0_1_tag-36-g3e4cab9",
+ "Rev": "3e4cab989c9525e3445e9a802b051e07622195c2"
},
{
"ImportPath": "mynewt.apache.org/newt/yaml",
- "Comment": "mynewt_1_0_1_tag-32-g84f53dd",
- "Rev": "84f53dd6fa887471393d955a5f179c89c57c95b3"
+ "Comment": "mynewt_1_0_1_tag-36-g3e4cab9",
+ "Rev": "3e4cab989c9525e3445e9a802b051e07622195c2"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/adv",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/bledefs",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/mgmt",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmble",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmp",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmserial",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmxutil",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/oic",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/omp",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/scan",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/sesn",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/udp",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xact",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xport",
- "Comment": "mynewt_1_1_0_tag-54-g96f7ef8",
- "Rev": "96f7ef876d0f42b96f125884a69ad2b2e44c9462"
+ "Comment": "mynewt_1_1_0_tag-56-ged10653",
+ "Rev": "ed106535065bac6b091b69766f48f1cffae85411"
}
]
}
diff --git a/newtmgr/vendor/github.com/runtimeco/go-coap/messagetcp.go b/newtmgr/vendor/github.com/runtimeco/go-coap/messagetcp.go
index 85a79d8..ec2658b 100644
--- a/newtmgr/vendor/github.com/runtimeco/go-coap/messagetcp.go
+++ b/newtmgr/vendor/github.com/runtimeco/go-coap/messagetcp.go
@@ -247,7 +247,7 @@ func PullTcp(data []byte) (*TcpMessage, []byte, error) {
r := bytes.NewReader(data)
m, err := Decode(r)
if err != nil {
- if err == io.EOF {
+ if err == io.EOF || err == io.ErrUnexpectedEOF {
// Packet is incomplete.
return nil, data, nil
} else {
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go
index b892d3d..6dc609f 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go
@@ -41,6 +41,12 @@ func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
return 0
}
+ s := b.x.findSesn(access.ConnHandle)
+ if s == nil {
+ // The sender is no longer connected.
+ return ERR_CODE_ATT_UNLIKELY
+ }
+
data, err := ml.MarshalBinary()
if err != nil {
return ERR_CODE_ATT_UNLIKELY
@@ -51,8 +57,19 @@ func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
return ERR_CODE_ATT_UNLIKELY
}
- if err := NotifyXact(b.x, access.ConnHandle, valHandle, data); err != nil {
- return ERR_CODE_ATT_UNLIKELY
+ mtu := s.MtuOut()
+ for off := 0; off < len(data); off += mtu {
+ chunkEnd := off + mtu
+ if chunkEnd > len(data) {
+ chunkEnd = len(data)
+ }
+ chunk := data[off:chunkEnd]
+
+ if err := NotifyXact(b.x, access.ConnHandle, valHandle,
+ chunk); err != nil {
+
+ return ERR_CODE_ATT_UNLIKELY
+ }
}
return 0
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go
index 2355c30..705c76b 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_sesn.go
@@ -91,6 +91,8 @@ func (s *BleSesn) disconnectListen() {
// If the session is being closed, unblock the close() call.
defer s.closeBlocker.Unblock(nil)
+ s.bx.removeSesn(s.conn.connHandle)
+
// Block until disconnect.
err := <-s.conn.DisconnectChan()
nmxutil.Assert(!s.IsOpen())
@@ -251,6 +253,10 @@ func (s *BleSesn) Open() error {
}
}
+ if err != nil {
+ s.bx.addSesn(s.conn.connHandle, s)
+ }
+
return err
}
@@ -273,6 +279,8 @@ func (s *BleSesn) OpenConnected(
// Listen for incoming notifications in the background.
s.notifyListen()
+ s.bx.addSesn(connHandle, s)
+
return nil
}
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_xport.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_xport.go
index 79a1f2c..03b158e 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_xport.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_xport.go
@@ -114,20 +114,22 @@ type BleXport struct {
master nmxutil.SingleResource
slave nmxutil.SingleResource
randAddr *BleAddr
- stateMtx sync.Mutex
+ mtx sync.Mutex
scanner *BleScanner
advertiser *Advertiser
cm ChrMgr
+ sesns map[uint16]*BleSesn
}
func NewBleXport(cfg XportCfg) (*BleXport, error) {
bx := &BleXport{
+ cfg: cfg,
d: NewDispatcher(),
shutdownChan: make(chan bool),
readyBcast: nmxutil.Bcaster{},
master: nmxutil.NewSingleResource(),
slave: nmxutil.NewSingleResource(),
- cfg: cfg,
+ sesns: map[uint16]*BleSesn{},
}
return bx, nil
@@ -258,7 +260,7 @@ func (bx *BleXport) shutdown(restart bool, err error) {
log.Debugf("Shutting down BLE transport")
- bx.stateMtx.Lock()
+ bx.mtx.Lock()
var fullyStarted bool
var already bool
@@ -278,13 +280,15 @@ func (bx *BleXport) shutdown(restart bool, err error) {
bx.state = BLE_XPORT_STATE_STOPPING
}
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
if already {
// Shutdown already in progress.
return
}
+ bx.sesns = map[uint16]*BleSesn{}
+
// Indicate error to all clients who are waiting for the master resource.
log.Debugf("Aborting BLE master")
bx.master.Abort(err)
@@ -321,22 +325,22 @@ func (bx *BleXport) shutdown(restart bool, err error) {
func (bx *BleXport) blockUntilReady() error {
var ch chan interface{}
- bx.stateMtx.Lock()
+ bx.mtx.Lock()
switch bx.state {
case BLE_XPORT_STATE_STARTED:
// Already started; don't block.
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
return nil
case BLE_XPORT_STATE_DORMANT:
// Not in the process of starting; the user will be waiting forever.
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
return fmt.Errorf("Attempt to use BLE transport without starting it")
default:
ch = bx.readyBcast.Listen()
}
- bx.stateMtx.Unlock()
+ bx.mtx.Unlock()
itf := <-ch
if itf == nil {
@@ -347,15 +351,15 @@ func (bx *BleXport) blockUntilReady() error {
}
func (bx *BleXport) getState() BleXportState {
- bx.stateMtx.Lock()
- defer bx.stateMtx.Unlock()
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
return bx.state
}
func (bx *BleXport) setStateFrom(from BleXportState, to BleXportState) bool {
- bx.stateMtx.Lock()
- defer bx.stateMtx.Unlock()
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
if bx.state != from {
return false
@@ -659,3 +663,28 @@ func (bx *BleXport) ReleaseSlave() {
func (bx *BleXport) StopWaitingForSlave(token interface{}, err error) {
bx.slave.StopWaiting(token, err)
}
+
+func (bx *BleXport) addSesn(connHandle uint16, s *BleSesn) {
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
+
+ bx.sesns[connHandle] = s
+}
+
+func (bx *BleXport) removeSesn(connHandle uint16) *BleSesn {
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
+
+ s := bx.sesns[connHandle]
+ if s != nil {
+ delete(bx.sesns, connHandle)
+ }
+ return s
+}
+
+func (bx *BleXport) findSesn(connHandle uint16) *BleSesn {
+ bx.mtx.Lock()
+ defer bx.mtx.Unlock()
+
+ return bx.sesns[connHandle]
+}
--
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.