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/08/24 00:53:24 UTC

[10/50] [abbrv] incubator-mynewt-core git commit: BLE Host - Don't allow >1 tx MTU request per conn.

BLE Host - Don't allow >1 tx MTU request per conn.


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

Branch: refs/heads/master
Commit: 277edafa0cdf40067cfffc4596a5bb65d4645986
Parents: 30d5d15
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Aug 12 17:46:39 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Aug 12 18:16:35 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_att_clt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/277edafa/net/nimble/host/src/ble_att_clt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_clt.c b/net/nimble/host/src/ble_att_clt.c
index ed36b7f..8170c6c 100644
--- a/net/nimble/host/src/ble_att_clt.c
+++ b/net/nimble/host/src/ble_att_clt.c
@@ -124,6 +124,22 @@ ble_att_clt_tx_mtu(uint16_t conn_handle, const struct ble_att_mtu_cmd *req)
         return BLE_HS_EINVAL;
     }
 
+    ble_hs_lock();
+
+    ble_att_conn_chan_find(conn_handle, &conn, &chan);
+    if (chan == NULL) {
+        rc = BLE_HS_ENOTCONN;
+    } else if (chan->blc_flags & BLE_L2CAP_CHAN_F_TXED_MTU) {
+        rc = BLE_HS_EALREADY;
+    } else {
+        rc = 0;
+    }
+    ble_hs_unlock();
+
+    if (rc != 0) {
+        return rc;
+    }
+
     rc = ble_att_clt_init_req(BLE_ATT_MTU_CMD_SZ, &txom);
     if (rc != 0) {
         return rc;