newtmgr - Revendor
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/commit/02401c9a Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/02401c9a Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/02401c9a Branch: refs/heads/master Commit: 02401c9a17ec0b3752e67c3958f1a481bf4ec96a Parents: d9849de Author: Christopher Collins <[email protected]> Authored: Thu Mar 16 14:13:34 2017 -0700 Committer: Christopher Collins <[email protected]> Committed: Tue Mar 28 15:38:36 2017 -0700 ---------------------------------------------------------------------- newtmgr/Godeps/Godeps.json | 54 ++++++++++---------- .../newt/nmxact/nmble/ble_fsm.go | 14 +++-- .../newt/nmxact/nmble/ble_oic_sesn.go | 5 +- .../newt/nmxact/nmble/ble_plain_sesn.go | 5 +- 4 files changed, 42 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/02401c9a/newtmgr/Godeps/Godeps.json ---------------------------------------------------------------------- diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json index d8a7f8a..e600078 100644 --- a/newtmgr/Godeps/Godeps.json +++ b/newtmgr/Godeps/Godeps.json @@ -39,7 +39,7 @@ }, { "ImportPath": "github.com/runtimeco/go-coap", - "Rev": "983dcc293d85e870e020b9cd4fce1edb47963a3b" + "Rev": "bd370e53f10e4e6ebb585bed665d5076ea71f56c" }, { "ImportPath": "github.com/spf13/cast", @@ -76,68 +76,68 @@ }, { "ImportPath": "mynewt.apache.org/newt/nmxact/bledefs", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/nmble", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/nmp", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/nmserial", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/nmxutil", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/omp", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/sesn", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/xact", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/nmxact/xport", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/util", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/util/unixchild", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/viper", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" }, { "ImportPath": "mynewt.apache.org/newt/yaml", - "Comment": "mynewt_1_0_0_b1_tag-196-gced4e6f", - "Rev": "ced4e6f68b9f254cf6e8b2c52d6183ab7eecfc8a" + "Comment": "mynewt_1_0_0_b1_tag-198-gedcfb8b", + "Rev": "edcfb8ba4504e88d30a79ce03509521f7ff50b1b" } ] } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/02401c9a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_fsm.go ---------------------------------------------------------------------- diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_fsm.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_fsm.go index e8ad433..a9ce890 100644 --- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_fsm.go +++ b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_fsm.go @@ -62,7 +62,8 @@ type BleFsm struct { attMtu int connChan chan error - mtx sync.Mutex + mtx sync.Mutex + lastStateChange time.Time // These variables must be protected by the mutex. bls map[*BleListener]struct{} @@ -92,6 +93,12 @@ func (bf *BleFsm) disconnectError(reason int) error { return nmxutil.NewBleSesnDisconnectError(reason, str) } +func (bf *BleFsm) closedError(msg string) error { + return nmxutil.NewSesnClosedError(fmt.Sprintf( + "%s; state=%d last-state-change=%s", + msg, bf.getState(), bf.lastStateChange)) +} + func (bf *BleFsm) getState() BleSesnState { bf.mtx.Lock() defer bf.mtx.Unlock() @@ -104,6 +111,7 @@ func (bf *BleFsm) setState(toState BleSesnState) { defer bf.mtx.Unlock() bf.state = toState + bf.lastStateChange = time.Now() } func (bf *BleFsm) transitionState(fromState BleSesnState, @@ -603,8 +611,8 @@ func (bf *BleFsm) Stop() (bool, error) { SESN_STATE_TERMINATING, SESN_STATE_CONN_CANCELLING: - return false, nmxutil.NewSesnClosedError( - "Attempt to close an unopened BLE session") + return false, + bf.closedError("Attempt to close an unopened BLE session") case SESN_STATE_CONNECTING: if err := bf.connCancel(); err != nil { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/02401c9a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_oic_sesn.go ---------------------------------------------------------------------- diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_oic_sesn.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_oic_sesn.go index f72bb48..6c6de2f 100644 --- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_oic_sesn.go +++ b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_oic_sesn.go @@ -7,7 +7,6 @@ import ( "mynewt.apache.org/newt/nmxact/bledefs" "mynewt.apache.org/newt/nmxact/nmp" - "mynewt.apache.org/newt/nmxact/nmxutil" "mynewt.apache.org/newt/nmxact/omp" "mynewt.apache.org/newt/nmxact/sesn" "mynewt.apache.org/newt/util" @@ -110,7 +109,7 @@ func (bos *BleOicSesn) Open() error { func (bos *BleOicSesn) Close() error { if !bos.setCloseChan() { - return nmxutil.NewSesnClosedError( + return bos.bf.closedError( "Attempt to close an unopened BLE session") } defer bos.clearCloseChan() @@ -165,7 +164,7 @@ func (bos *BleOicSesn) TxNmpOnce(m *nmp.NmpMsg, opt sesn.TxOptions) ( nmp.NmpRsp, error) { if !bos.IsOpen() { - return nil, nmxutil.NewSesnClosedError( + return nil, bos.bf.closedError( "Attempt to transmit over closed BLE session") } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/02401c9a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_plain_sesn.go ---------------------------------------------------------------------- diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_plain_sesn.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_plain_sesn.go index 7ee99f2..967e320 100644 --- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_plain_sesn.go +++ b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_plain_sesn.go @@ -7,7 +7,6 @@ import ( "mynewt.apache.org/newt/nmxact/bledefs" "mynewt.apache.org/newt/nmxact/nmp" - "mynewt.apache.org/newt/nmxact/nmxutil" "mynewt.apache.org/newt/nmxact/sesn" "mynewt.apache.org/newt/util" ) @@ -104,7 +103,7 @@ func (bps *BlePlainSesn) Open() error { func (bps *BlePlainSesn) Close() error { if !bps.setCloseChan() { - return nmxutil.NewSesnClosedError( + return bps.bf.closedError( "Attempt to close an unopened BLE session") } defer bps.clearCloseChan() @@ -159,7 +158,7 @@ func (bps *BlePlainSesn) TxNmpOnce(msg *nmp.NmpMsg, opt sesn.TxOptions) ( nmp.NmpRsp, error) { if !bps.IsOpen() { - return nil, nmxutil.NewSesnClosedError( + return nil, bps.bf.closedError( "Attempt to transmit over closed BLE session") }
