Skip to content

Commit c4fd318

Browse files
peterhurleyholtmann
authored andcommitted
Bluetooth: Directly close dlc for not yet started RFCOMM session
If the RFCOMM session has not yet been started (ie., session is still in BT_BOUND state) when a dlc is closed, directly close and unlink the dlc rather than sending a DISC frame that is never sent. This allows the dlci to be immediately reused rather than waiting for a 20 second timeout. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Tested-By: Alexander Holler <holler@ahsoftware.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent f622357 commit c4fd318

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎net/bluetooth/rfcomm/core.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,19 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
468468

469469
switch (d->state) {
470470
case BT_CONNECT:
471-
case BT_CONFIG:
472-
/* Fall through */
473-
474471
case BT_CONNECTED:
475472
__rfcomm_dlc_disconn(d);
476473
break;
477474

475+
case BT_CONFIG:
476+
if (s->state != BT_BOUND) {
477+
__rfcomm_dlc_disconn(d);
478+
break;
479+
}
480+
/* if closing a dlc in a session that hasn't been started,
481+
* just close and unlink the dlc
482+
*/
483+
478484
default:
479485
rfcomm_dlc_clear_timer(d);
480486

0 commit comments

Comments
 (0)