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 2016/11/30 20:07:03 UTC

[2/8] incubator-mynewt-core git commit: nimble/l2cap: Fix for handling unknown response

nimble/l2cap: Fix for handling unknown response

According to BT Spec.v4.2 [Vol 3, Part A], command response with
unknown identifier shall be silently ignored.
For this reason we return 0 as next patches will start to send
"command not understood" in case of error.

Unit test updated accordingly.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/9db957a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9db957a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9db957a5

Branch: refs/heads/develop
Commit: 9db957a5e70b97418fe65803f344a640a6e18f93
Parents: 0850fcd
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Tue Nov 29 22:54:15 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:48 2016 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_l2cap_sig.c       | 2 +-
 net/nimble/host/test/src/ble_l2cap_test.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9db957a5/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 5ba650e..1223934 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -387,7 +387,7 @@ ble_l2cap_sig_update_rsp_rx(uint16_t conn_handle,
                                       BLE_L2CAP_SIG_PROC_OP_UPDATE,
                                       hdr->identifier);
     if (proc == NULL) {
-        return BLE_HS_ENOENT;
+        return 0;
     }
 
     rc = ble_hs_mbuf_pullup_base(om, BLE_L2CAP_SIG_UPDATE_RSP_SZ);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9db957a5/net/nimble/host/test/src/ble_l2cap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_l2cap_test.c b/net/nimble/host/test/src/ble_l2cap_test.c
index c25fe9a..7be148c 100644
--- a/net/nimble/host/test/src/ble_l2cap_test.c
+++ b/net/nimble/host/test/src/ble_l2cap_test.c
@@ -367,7 +367,7 @@ TEST_CASE(ble_l2cap_test_case_sig_unsol_rsp)
 
     /* Receive an unsolicited response. */
     rc = ble_hs_test_util_rx_l2cap_update_rsp(2, 100, 0);
-    TEST_ASSERT(rc == BLE_HS_ENOENT);
+    TEST_ASSERT(rc == 0);
 
     /* Ensure we did not send anything in return. */
     ble_hs_test_util_tx_all();
@@ -547,7 +547,7 @@ TEST_CASE(ble_l2cap_test_case_sig_update_init_fail_bad_id)
 
     /* Receive response from peer with incorrect ID. */
     rc = ble_hs_test_util_rx_l2cap_update_rsp(2, id + 1, 0);
-    TEST_ASSERT(rc == BLE_HS_ENOENT);
+    TEST_ASSERT(rc == 0);
 
     /* Ensure callback did not get called. */
     TEST_ASSERT(ble_l2cap_test_update_status == -1);