Skip to content

Commit

Permalink
Add "nasty fix" by geeksville, cfr esp-nimble issue espressif#16
Browse files Browse the repository at this point in the history
  • Loading branch information
jspngh committed May 5, 2023
1 parent 4ed9533 commit b1946ea
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions nimble/host/src/ble_hs_resolv.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,17 @@ ble_hs_resolv_list_add(uint8_t *cmdbuf)
addr_type = cmdbuf[0];
ident_addr = cmdbuf + 1;

if (ble_hs_is_on_resolv_list(ident_addr, addr_type)) {
return BLE_HS_EINVAL;
// There might be an existing entry - if so, delete it.
// Note: using ble_hs_resolv_list_rmv does not work,
// because that also updates some other datastructure and fails at boot.
// ble_hs_resolv_list_rmv(ident_addr, addr_type);
int position = ble_hs_is_on_resolv_list(ident_addr, addr_type);
if (position) {
memmove(&g_ble_hs_resolv_list[position],
&g_ble_hs_resolv_list[position + 1],
(g_ble_hs_resolv_data.rl_cnt - position) * sizeof (struct
ble_hs_resolv_entry));
--g_ble_hs_resolv_data.rl_cnt;
}

rl = &g_ble_hs_resolv_list[g_ble_hs_resolv_data.rl_cnt];
Expand Down

0 comments on commit b1946ea

Please sign in to comment.