Bluetooth: Disallow outgoing LE connections during explicit scan

The explicit scan API should be thought of as the user taking control
of the scanning policy. In this case the stack shouldn't try to
second-guess and create connections in between.

Change-Id: I47cc5d70660706d6657deac50aa0619cbe4bf727
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-12-03 19:45:46 +02:00 committed by Anas Nashif
commit 9862a25584
2 changed files with 9 additions and 0 deletions

View file

@ -833,6 +833,10 @@ struct bt_conn *bt_conn_create_le(const bt_addr_le_t *peer)
{
struct bt_conn *conn;
if (atomic_test_bit(bt_dev.flags, BT_DEV_EXPLICIT_SCAN)) {
return NULL;
}
conn = bt_conn_lookup_addr_le(peer);
if (conn) {
switch (conn->state) {

View file

@ -712,6 +712,11 @@ static void check_pending_conn(const bt_addr_le_t *id_addr,
{
struct bt_conn *conn;
/* No connections are allowed during explicit scanning */
if (atomic_test_bit(bt_dev.flags, BT_DEV_EXPLICIT_SCAN)) {
return;
}
/* Return if event is not connectable */
if (evtype != BT_LE_ADV_IND && evtype != BT_LE_ADV_DIRECT_IND) {
return;