Bluetooth: L2CAP: Make sure state is correctly updated

This makes l2cap_chan_add updates the state to CONNECT so it doesn't
have to be done manually for both incoming and outgoing code paths.

Change-Id: I7331e49c675c83c6c1b184eeecc49c75c446a1ff
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2017-01-17 12:35:35 +02:00 committed by Johan Hedberg
commit 514c9fa55f

View file

@ -326,6 +326,10 @@ static bool l2cap_chan_add(struct bt_conn *conn, struct bt_l2cap_chan *chan,
bt_l2cap_chan_add(conn, chan, destroy);
if (IS_ENABLED(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)) {
bt_l2cap_chan_set_state(chan, BT_L2CAP_CONNECT);
}
return true;
}
@ -1451,7 +1455,6 @@ static int l2cap_le_connect(struct bt_conn *conn, struct bt_l2cap_le_chan *ch,
}
ch->chan.psm = psm;
bt_l2cap_chan_set_state(&ch->chan, BT_L2CAP_CONNECT);
return l2cap_le_conn_req(ch);
}