From e36d58e593f2e925bc6672a76f45fb23e8a0f138 Mon Sep 17 00:00:00 2001 From: Jaganath Kanakkassery Date: Wed, 23 Nov 2016 18:25:35 +0530 Subject: [PATCH] Bluetooth: RFCOMM: Remove send DM from drop() rfcomm_dlc_drop() can be used from many places to unlink dlc from session and destroy it. So it is better to send DM explicitly from relevant places. Change-Id: I9b6a31ce5bb65b90510aa483539d4a201ba12b60 Signed-off-by: Jaganath Kanakkassery --- subsys/bluetooth/host/rfcomm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/rfcomm.c b/subsys/bluetooth/host/rfcomm.c index 0e326700eec..0dca5e45e9c 100644 --- a/subsys/bluetooth/host/rfcomm.c +++ b/subsys/bluetooth/host/rfcomm.c @@ -607,9 +607,6 @@ static void rfcomm_dlc_drop(struct bt_rfcomm_dlc *dlc) { BT_DBG("dlc %p", dlc); - if (dlc->role == BT_RFCOMM_ROLE_ACCEPTOR) { - rfcomm_send_dm(dlc->session, dlc->dlci); - } rfcomm_dlcs_remove_dlci(dlc->session->dlcs, dlc->dlci); rfcomm_dlc_destroy(dlc); } @@ -645,6 +642,7 @@ static void rfcomm_handle_sabm(struct bt_rfcomm_session *session, uint8_t dlci) break; case RFCOMM_SECURITY_REJECT: default: + rfcomm_send_dm(session, dlci); rfcomm_dlc_drop(dlc); return; } @@ -1068,6 +1066,7 @@ static void rfcomm_encrypt_change(struct bt_l2cap_chan *chan, if (hci_status || !conn->encrypt || conn->sec_level < dlc->required_sec_level) { + rfcomm_send_dm(session, dlc->dlci); rfcomm_dlc_drop(dlc); continue; }