This is an automated email from the ASF dual-hosted git repository.
naveenkaje 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 d1f7072 transceiver: Fix NMP Async Listener
new 8984870 Merge pull request #170 from nkaje/fix_dfu_ble_error
d1f7072 is described below
commit d1f70726cdbcb57f2b46668b30468f8ebaa6ab00
Author: Naveen Kaje <[email protected]>
AuthorDate: Tue Aug 25 17:50:15 2020 -0500
transceiver: Fix NMP Async Listener
NMP Async listener should be released in the gofunc.
This fixes the following error seen with DFU.
Error signature:
$sudo ~/go/bin/newtmgr --conntype ble --connstring peer_name='DUT1000'
image upload application.bin
0 B / 99.04 KiB
[---------------------------------------------------------] 0.00%
panic: send on closed channel
goroutine 67 [running]:
mynewt.apache.org/newtmgr/nmxact/nmp.(*Listener).AfterTimeout.func1()
/home/naveen/go/src/mynewt.apache.org/newtmgr/nmxact/nmp/dispatch.go:50
+0x64
created by time.goFunc
/usr/local/go/src/time/sleep.go:168 +0x44
Signed-off-by: Naveen Kaje <[email protected]>
---
nmxact/mgmt/transceiver.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nmxact/mgmt/transceiver.go b/nmxact/mgmt/transceiver.go
index 894605f..8bf41e6 100644
--- a/nmxact/mgmt/transceiver.go
+++ b/nmxact/mgmt/transceiver.go
@@ -121,7 +121,6 @@ func (t *Transceiver) txRxNmpAsync(txCb TxFn, req
*nmp.NmpMsg, mtu int,
if err != nil {
return err
}
- defer t.nd.RemoveListener(req.Hdr.Seq)
b, err := nmp.EncodeNmpPlain(req)
if err != nil {
@@ -141,6 +140,7 @@ func (t *Transceiver) txRxNmpAsync(txCb TxFn, req
*nmp.NmpMsg, mtu int,
// Now wait for NMP response.
go func() {
+ defer t.nd.RemoveListener(req.Hdr.Seq)
for {
select {
case err := <-nl.ErrChan: