Bluetooth: conn: Pass disconnect error properly to the conn struct

The bt_conn_set_state() function will not notify the connected
callback of the connection error if conn->err isn't properly set.

Jira: ZEP-2005

Change-Id: Idc30e736f4d8ba00156bf5c0e37dcccdb151742f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-04-07 21:28:58 +03:00 committed by Luiz Augusto von Dentz
commit 71d0843c7d

View file

@ -1631,6 +1631,7 @@ int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason)
switch (conn->state) { switch (conn->state) {
case BT_CONN_CONNECT_SCAN: case BT_CONN_CONNECT_SCAN:
conn->err = reason;
bt_conn_set_state(conn, BT_CONN_DISCONNECTED); bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
bt_le_scan_update(false); bt_le_scan_update(false);
return 0; return 0;