goto unlock;
if (status) {
+ u8 type = conn->type;
mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
conn->dst_type, status);
- if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) {
- hdev->cur_adv_instance = conn->adv_instance;
+ if (type == LE_LINK)
hci_enable_advertising(hdev);
- }
/* Inform sockets conn is gone before we delete it */
hci_disconn_cfm(conn, HCI_ERROR_UNSPECIFIED);
struct hci_conn_params *params;
struct hci_conn *conn;
bool mgmt_connected;
+ u8 type;
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
break;
}
}
+ type = conn->type;
hci_disconn_cfm(conn, ev->reason);
+ hci_conn_del(conn);
/* Re-enable advertising if necessary, since it might
* have been disabled by the connection. From the
* or until a connection is created or until the Advertising
* is timed out due to Directed Advertising."
*/
- if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) {
- hdev->cur_adv_instance = conn->adv_instance;
+
+ if (type == LE_LINK)
hci_enable_advertising(hdev);
- }
- hci_conn_del(conn);
#ifdef TIZEN_BT
if (conn->type == ACL_LINK && !hci_conn_num(hdev, ACL_LINK)) {
conn->sec_level = BT_SECURITY_LOW;
conn->state = BT_CONFIG;
- /* Store current advertising instance as connection advertising instance
- * when sotfware rotation is in use so it can be re-enabled when
- * disconnected.
- */
- if (!ext_adv_capable(hdev))
- conn->adv_instance = hdev->cur_adv_instance;
-
conn->le_conn_interval = interval;
conn->le_conn_latency = latency;
conn->le_supv_timeout = supervision_timeout;
{
struct hci_evt_le_ext_adv_set_term *ev = data;
struct hci_conn *conn;
- struct adv_info *adv, *n;
+ struct adv_info *n;
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
hci_dev_lock(hdev);
- adv = hci_find_adv_instance(hdev, ev->handle);
if (ev->status) {
+ struct adv_info *adv;
+ adv = hci_find_adv_instance(hdev, ev->handle);
if (!adv)
goto unlock;
goto unlock;
}
- if (adv)
- adv->enabled = false;
-
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle));
if (conn) {
- /* Store handle in the connection so the correct advertising
- * instance can be re-enabled when disconnected.
- */
- conn->adv_instance = ev->handle;
+ struct adv_info *adv_instance;
if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM ||
bacmp(&conn->resp_addr, BDADDR_ANY))
goto unlock;
}
- if (adv)
- bacpy(&conn->resp_addr, &adv->random_addr);
+ adv_instance = hci_find_adv_instance(hdev, ev->handle);
+ if (adv_instance)
+ bacpy(&conn->resp_addr, &adv_instance->random_addr);
}
unlock: