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/02/11 20:07:55 UTC

[1/2] incubator-mynewt-core git commit: BLE host - add chr-read app err to unit tests.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 851880542 -> d61c6cd08


BLE host - add chr-read app err to unit tests.


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/d61c6cd0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d61c6cd0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d61c6cd0

Branch: refs/heads/develop
Commit: d61c6cd08b054e1ea8b829a0b74aa6ce2688357a
Parents: 206d7fd
Author: Christopher Collins <cc...@apache.org>
Authored: Sat Feb 11 12:06:53 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Sat Feb 11 12:07:45 2017 -0800

----------------------------------------------------------------------
 net/nimble/host/test/src/ble_att_svr_test.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d61c6cd0/net/nimble/host/test/src/ble_att_svr_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_att_svr_test.c b/net/nimble/host/test/src/ble_att_svr_test.c
index 8ee9bc6..c5b964a 100644
--- a/net/nimble/host/test/src/ble_att_svr_test.c
+++ b/net/nimble/host/test/src/ble_att_svr_test.c
@@ -138,6 +138,15 @@ ble_att_svr_test_misc_attr_fn_r_2(uint16_t conn_handle, uint16_t attr_handle,
     }
 }
 
+static int
+ble_att_svr_test_misc_attr_fn_r_err(uint16_t conn_handle, uint16_t attr_handle,
+                                    uint8_t op, uint16_t offset,
+                                    struct os_mbuf **om, void *arg)
+{
+    os_mbuf_append(*om, (uint8_t[4]){1,2,3,4}, 4);
+    return BLE_ATT_ERR_UNLIKELY;
+}
+
 #define BLE_ATT_SVR_TEST_LAST_SVC  11
 #define BLE_ATT_SVR_TEST_LAST_ATTR 24
 
@@ -777,6 +786,8 @@ TEST_CASE(ble_att_svr_test_read)
     uint16_t conn_handle;
     const ble_uuid_t *uuid_sec = BLE_UUID128_DECLARE( \
         1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    const ble_uuid_t *uuid_bad = BLE_UUID128_DECLARE( \
+        2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
     const ble_uuid_t *uuid = BLE_UUID128_DECLARE( \
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, );
     int rc;
@@ -790,6 +801,16 @@ TEST_CASE(ble_att_svr_test_read)
     ble_hs_test_util_verify_tx_err_rsp(BLE_ATT_OP_READ_REQ, 0,
                                        BLE_ATT_ERR_INVALID_HANDLE);
 
+    /*** Application error. */
+    rc = ble_att_svr_register(uuid_bad, HA_FLAG_PERM_RW, 0, &attr_handle,
+                              ble_att_svr_test_misc_attr_fn_r_err, NULL);
+    TEST_ASSERT(rc == 0);
+
+    rc = ble_hs_test_util_rx_att_read_req(conn_handle, attr_handle);
+    TEST_ASSERT(rc == BLE_HS_EAPP);
+    ble_hs_test_util_verify_tx_err_rsp(BLE_ATT_OP_READ_REQ, attr_handle,
+                                       BLE_ATT_ERR_UNLIKELY);
+
     /*** Successful read. */
     ble_att_svr_test_attr_r_1 = (uint8_t[]){0,1,2,3,4,5,6,7};
     ble_att_svr_test_attr_r_1_len = 8;


[2/2] incubator-mynewt-core git commit: MYNEWT-579 Free rxed l2cap frags on disconnect.

Posted by cc...@apache.org.
MYNEWT-579 Free rxed l2cap frags on disconnect.

This may not a different mbuf leak, but it was discovered while
debugging this issue.


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/206d7fdb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/206d7fdb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/206d7fdb

Branch: refs/heads/develop
Commit: 206d7fdb9ab7751ebfc276fc551767949e9a2eab
Parents: 8518805
Author: Christopher Collins <cc...@apache.org>
Authored: Sat Feb 11 12:05:08 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Sat Feb 11 12:07:45 2017 -0800

----------------------------------------------------------------------
 net/nimble/host/src/ble_l2cap.c           | 2 ++
 net/nimble/host/test/src/ble_l2cap_test.c | 5 +++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/206d7fdb/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index fc8ecb9..fa02ec2 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -75,6 +75,8 @@ ble_l2cap_chan_free(struct ble_l2cap_chan *chan)
         return;
     }
 
+    os_mbuf_free_chain(chan->blc_rx_buf);
+
     rc = os_memblock_put(&ble_l2cap_chan_pool, chan);
     BLE_HS_DBG_ASSERT_EVAL(rc == 0);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/206d7fdb/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 526436c..2681b26 100644
--- a/net/nimble/host/test/src/ble_l2cap_test.c
+++ b/net/nimble/host/test/src/ble_l2cap_test.c
@@ -367,6 +367,11 @@ TEST_CASE(ble_l2cap_test_case_frag_channels)
     TEST_ASSERT(conn->bhc_rx_chan != NULL &&
                 conn->bhc_rx_chan->blc_cid == BLE_L2CAP_CID_ATT);
     ble_hs_unlock();
+
+    /* Terminate the connection.  The received fragments should get freed.
+     * Mbuf leaks are tested in the post-test-case callback.
+     */
+    ble_hs_test_util_conn_disconnect(2);
 }
 
 TEST_CASE(ble_l2cap_test_case_frag_timeout)