Bluetooth: Don't delay bt_conn connected callback

Delaying only connected callback resulted in races where security
or pairing callback could be called before bt_conn connected.

Currently only procedure that relies on read features is connection
parameters update and that should not conflict with other traffic.

Change-Id: I835535abbff21ea8d86b728f5681f90ef9fd337c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-10-05 15:10:59 +02:00 committed by Anas Nashif
commit 89f8453ebe
4 changed files with 4 additions and 12 deletions

View file

@ -82,7 +82,7 @@ static const char *state2str(bt_conn_state_t state)
}
#endif
void bt_conn_connected(struct bt_conn *conn)
static void bt_conn_connected(struct bt_conn *conn)
{
struct bt_conn_cb *cb;
@ -497,6 +497,7 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state)
(int)bt_conn_get(conn), 0, 7, 0);
bt_l2cap_connected(conn);
bt_conn_connected(conn);
break;
case BT_CONN_DISCONNECTED:
/* Send dummy buffer to wake up and stop the tx fiber

View file

@ -123,9 +123,6 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state);
int bt_conn_le_conn_update(struct bt_conn *conn, uint16_t min, uint16_t max,
uint16_t latency, uint16_t timeout);
/* Notify higher layers of a new connection */
void bt_conn_connected(struct bt_conn *conn);
#if defined(CONFIG_BLUETOOTH_SMP)
/* rand and ediv should be in BT order */
int bt_conn_le_start_encryption(struct bt_conn *conn, uint64_t rand,

View file

@ -527,9 +527,7 @@ static void le_conn_complete(struct bt_buf *buf)
}
}
if (update_conn_params(conn)) {
bt_conn_connected(conn);
}
update_conn_params(conn);
done:
bt_conn_put(conn);
@ -553,9 +551,7 @@ static void le_remote_feat_complete(struct bt_buf *buf)
sizeof(conn->le_features));
}
if (update_conn_params(conn)) {
bt_conn_connected(conn);
}
update_conn_params(conn);
bt_conn_put(conn);
}

View file

@ -161,8 +161,6 @@ static void le_conn_param_rsp(struct bt_conn *conn, struct bt_buf *buf)
}
BT_DBG("LE conn param rsp result %u\n", sys_le16_to_cpu(rsp->result));
bt_conn_connected(conn);
}
#if defined(CONFIG_BLUETOOTH_CENTRAL)