le_device_db_tlv: don't increase num valid entries if entry is replaced

This commit is contained in:
Matthias Ringwald 2021-11-04 10:33:58 +01:00
parent 2fca4dad95
commit 99f3ea79a3
2 changed files with 6 additions and 3 deletions

View File

@ -37,7 +37,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- SM: Work around for unexpected Windows 10 disconnect for BR Secure Connections (SMP over BR timeout)
- SM: support storing bonding information for devices with identical IRK but different public addresses
- GAP: restart advertising when private address changes
- le_device_db_tlv: keep number of devices reported by le_device_db_count if old entry is replaced
### Changed
- Drop iOS support
- HCI: provide status instead of undocumented int error code and bool for API functions

View File

@ -203,6 +203,7 @@ int le_device_db_add(int addr_type, bd_addr_t addr, sm_key_t irk){
int index_for_lowest_seq_nr = -1;
int index_for_addr = -1;
int index_for_empty = -1;
bool new_entry = false;
// find unused entry in the used list
int i;
@ -234,6 +235,7 @@ int le_device_db_add(int addr_type, bd_addr_t addr, sm_key_t irk){
if (index_for_addr >= 0){
index_to_use = index_for_addr;
} else if (index_for_empty >= 0){
new_entry = true;
index_to_use = index_for_empty;
} else if (index_for_lowest_seq_nr >= 0){
index_to_use = index_for_lowest_seq_nr;
@ -268,8 +270,8 @@ int le_device_db_add(int addr_type, bd_addr_t addr, sm_key_t irk){
// set in entry_mape
entry_map[index_to_use] = 1;
// keep track - don't increase if old entry found
if (index_for_addr < 0){
// keep track - don't increase if old entry found or replaced
if (new_entry){
num_valid_entries++;
}