[PATCH 2/3] bluetooth: rfcomm: Create new session if closing old session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the rfcomm session has already sent DISC (thus in BT_DISCONN
state), allow dlc opens to create a new session instead of trying
to open a dlc in a closing session (and instead of returning an
error).

Allow multiple rfcomm sessions with the same endpoints as long as
the existing sessions are either in BT_DISCONN or BT_CLOSED states.

Fixes multi-second delays when running rctest -c on one station
and rctest -r on the other.

Reported-by: Scott James Remnant <keybuk@xxxxxxxxxxxx>
Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
---
 net/bluetooth/rfcomm/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 6aa90c0..292322c 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -695,6 +695,9 @@ static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst)
 		s = list_entry(p, struct rfcomm_session, list);
 		chan = l2cap_pi(s->sock->sk)->chan;
 
+		if (s->state == BT_DISCONN || s->state == BT_CLOSED)
+			continue;
+
 		if ((!bacmp(src, BDADDR_ANY) || !bacmp(&chan->src, src)) &&
 		    !bacmp(&chan->dst, dst))
 			return s;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux