diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-02-15 20:59:49 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-02-27 00:14:47 -0500 |
commit | 8bf4794174659b06d43cc5e290cd384757374613 (patch) | |
tree | d728d18b4725e1b4f4b421703e020af16772008c /net/bluetooth | |
parent | d5f2d2be68876f65dd051b978a7b66265fde9ffd (diff) |
Bluetooth: Change RFCOMM to use BT_CONNECT2 for BT_DEFER_SETUP
When BT_DEFER_SETUP is enabled on a RFCOMM socket, then switch its
current state from BT_OPEN to BT_CONNECT2. This gives the Bluetooth
core a unified way to handle L2CAP and RFCOMM sockets. The BT_CONNECT2
state is designated for incoming connections.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 1828ec06ad1c..5576c8191507 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -448,6 +448,7 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err) | |||
448 | break; | 448 | break; |
449 | 449 | ||
450 | case BT_OPEN: | 450 | case BT_OPEN: |
451 | case BT_CONNECT2: | ||
451 | if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) { | 452 | if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) { |
452 | set_bit(RFCOMM_AUTH_REJECT, &d->flags); | 453 | set_bit(RFCOMM_AUTH_REJECT, &d->flags); |
453 | rfcomm_schedule(RFCOMM_SCHED_AUTH); | 454 | rfcomm_schedule(RFCOMM_SCHED_AUTH); |
@@ -1208,6 +1209,11 @@ static void rfcomm_check_accept(struct rfcomm_dlc *d) | |||
1208 | if (d->defer_setup) { | 1209 | if (d->defer_setup) { |
1209 | set_bit(RFCOMM_DEFER_SETUP, &d->flags); | 1210 | set_bit(RFCOMM_DEFER_SETUP, &d->flags); |
1210 | rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); | 1211 | rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); |
1212 | |||
1213 | rfcomm_dlc_lock(d); | ||
1214 | d->state = BT_CONNECT2; | ||
1215 | d->state_change(d, 0); | ||
1216 | rfcomm_dlc_unlock(d); | ||
1211 | } else | 1217 | } else |
1212 | rfcomm_dlc_accept(d); | 1218 | rfcomm_dlc_accept(d); |
1213 | } else { | 1219 | } else { |
@@ -1749,6 +1755,11 @@ static inline void rfcomm_process_dlcs(struct rfcomm_session *s) | |||
1749 | if (d->defer_setup) { | 1755 | if (d->defer_setup) { |
1750 | set_bit(RFCOMM_DEFER_SETUP, &d->flags); | 1756 | set_bit(RFCOMM_DEFER_SETUP, &d->flags); |
1751 | rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); | 1757 | rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); |
1758 | |||
1759 | rfcomm_dlc_lock(d); | ||
1760 | d->state = BT_CONNECT2; | ||
1761 | d->state_change(d, 0); | ||
1762 | rfcomm_dlc_unlock(d); | ||
1752 | } else | 1763 | } else |
1753 | rfcomm_dlc_accept(d); | 1764 | rfcomm_dlc_accept(d); |
1754 | } | 1765 | } |