nimble/l2cap: Fix for reject incoming LE CoC channel

With this patch, when user rejects incoming connection stack not send
BLE_L2CAP_EVENT_COC_DISCONNECTED event


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

Branch: refs/heads/master
Commit: 41c9c799807bc654ef20361611ba732c68012979
Parents: 11d2cb5
Author: Łukasz Rymanowski <[email protected]>
Authored: Wed Mar 15 14:02:17 2017 +0100
Committer: Łukasz Rymanowski <[email protected]>
Committed: Thu Apr 6 10:04:03 2017 +0200

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


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/41c9c799/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 ae99f00..d9e7c52 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -695,6 +695,10 @@ ble_l2cap_sig_coc_req_rx(uint16_t conn_handle, struct 
ble_l2cap_sig_hdr *hdr,
     rc = ble_l2cap_event_coc_accept(chan, le16toh(req->mtu));
     if (rc != 0) {
         uint16_t coc_err = ble_l2cap_sig_ble_hs_err2coc_err(rc);
+
+        /* Make sure we do not send disconnect event when removing channel */
+        chan->cb = NULL;
+
         ble_l2cap_chan_free(chan);
         rsp->result = htole16(coc_err);
         goto failed;

Reply via email to