Revert "Nimble: Fix memory corruption introduced due to wrong index of array"

This reverts commit e8e2b61c6a.

Cleaner fix to be added as this code still causes issues. Temporarily
reverting
This commit is contained in:
Rahul Tank
2022-08-22 11:55:53 +05:30
parent e8e2b61c6a
commit ff10868337
+5 -5
View File
@@ -186,23 +186,23 @@ ble_hs_hci_evt_disconn_complete(uint8_t event_code, const void *data,
if (ev->reason == BLE_ERR_CONN_ESTABLISHMENT && (conn != NULL)) {
BLE_HS_LOG(DEBUG, "Reattempt connection; reason = 0x%x, status = %d,"
" reattempt count = %d ", ev->reason, ev->status,
reattempt_conn[ev->conn_handle-1]);
reattempt_conn[ev->conn_handle]);
if (conn->bhc_flags & BLE_HS_CONN_F_MASTER) {
if (reattempt_conn[ev->conn_handle-1] < MAX_REATTEMPT_ALLOWED) {
reattempt_conn[ev->conn_handle-1] += 1;
if (reattempt_conn[ev->conn_handle] < MAX_REATTEMPT_ALLOWED) {
reattempt_conn[ev->conn_handle] += 1;
rc = ble_gap_master_connect_reattempt(ev->conn_handle);
if (rc != 0) {
BLE_HS_LOG(DEBUG, "Master reconnect attempt failed; rc = %d", rc);
}
} else {
reattempt_conn[ev->conn_handle-1] = 0;
reattempt_conn[ev->conn_handle] = 0;
}
}
} else {
/* Disconnect completed with some other reason than
* BLE_ERR_CONN_ESTABLISHMENT, reset the corresponding reattempt count
* */
reattempt_conn[ev->conn_handle-1] = 0;
reattempt_conn[ev->conn_handle] = 0;
}
#endif