MT#62181 RegisterCache: use entries_by_time

We can now use the sets to iterate the bindings in order of their
expiry and exit the loop when we encounter the first one with an expiry
in the future.

Change-Id: I093bea9807b4a432ac965b402394edc43eef5a1f
mr13.4
Richard Fuchs 1 year ago
parent d62a847138
commit 1e02557951

@ -41,8 +41,14 @@ void AorHash::dump_elmt(const string& aor,
void AorHash::gbc(long int now,
list<string>& alias_list)
{
for(auto it = begin(); it != end();) {
for (auto set_it = entries_by_time.begin(); set_it != entries_by_time.end();) {
iterator it = *set_it;
auto next = set_it;
next++;
AorEntry& aor_e = it->second;
if (aor_e.get_lowest_expire() > now)
break;
for (AorEntry::iterator reg_it = aor_e.begin();
reg_it != aor_e.end();) {
@ -63,13 +69,11 @@ void AorHash::gbc(long int now,
}
reg_it++;
}
if(it->second.empty()) {
if (aor_e.empty()) {
DBG("delete empty AOR: '%s'", it->first.c_str());
auto del_it = it++;
erase(del_it);
continue;
erase(it);
}
it++;
set_it = next;
}
}

Loading…
Cancel
Save