diff options
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 3ce5ae493d1d..5acc82fa0200 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -431,6 +431,20 @@ int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 chann | |||
431 | return r; | 431 | return r; |
432 | } | 432 | } |
433 | 433 | ||
434 | static void __rfcomm_dlc_disconn(struct rfcomm_dlc *d) | ||
435 | { | ||
436 | struct rfcomm_session *s = d->session; | ||
437 | |||
438 | d->state = BT_DISCONN; | ||
439 | if (skb_queue_empty(&d->tx_queue)) { | ||
440 | rfcomm_send_disc(s, d->dlci); | ||
441 | rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT); | ||
442 | } else { | ||
443 | rfcomm_queue_disc(d); | ||
444 | rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT * 2); | ||
445 | } | ||
446 | } | ||
447 | |||
434 | static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err) | 448 | static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err) |
435 | { | 449 | { |
436 | struct rfcomm_session *s = d->session; | 450 | struct rfcomm_session *s = d->session; |
@@ -458,14 +472,7 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err) | |||
458 | /* Fall through */ | 472 | /* Fall through */ |
459 | 473 | ||
460 | case BT_CONNECTED: | 474 | case BT_CONNECTED: |
461 | d->state = BT_DISCONN; | 475 | __rfcomm_dlc_disconn(d); |
462 | if (skb_queue_empty(&d->tx_queue)) { | ||
463 | rfcomm_send_disc(s, d->dlci); | ||
464 | rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT); | ||
465 | } else { | ||
466 | rfcomm_queue_disc(d); | ||
467 | rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT * 2); | ||
468 | } | ||
469 | break; | 476 | break; |
470 | 477 | ||
471 | default: | 478 | default: |