MT#62181 RegisterCache: private AorEntry::erase

Move deletion of bindings into AorHash, similar to how expire times are
set. This makes it possible to manage expiry in a central place.

Change-Id: I76a72881ed202e85fb70e9d8526bac55863d07db
master
Richard Fuchs 4 weeks ago
parent d00be5a396
commit 819e45ec9c

@ -58,7 +58,7 @@ void AorHash::gbc(long int now,
del_it->first.c_str(), binding.alias.c_str(),
binding.get_expire(), now);
it->second.erase(del_it);
erase_binding(it, del_it);
continue;
}
reg_it++;
@ -410,7 +410,7 @@ void _RegisterCache::update(long int reg_expires, const AliasEntry& alias_update
// relink binding with the new index
auto binding = binding_it->second;
aor_e_it->second.erase(binding_it);
reg_cache_ht.erase_binding(aor_e_it, binding_it);
binding_it = aor_e_it->second.insert(make_pair(idx, binding)).first;
}
}
@ -518,7 +518,7 @@ void _RegisterCache::remove(const string& canon_aor, const string& uri,
if (binding.alias == alias) {
AorEntry::iterator del_it = binding_it++;
aor_e.erase(del_it);
reg_cache_ht.erase_binding(aor_e_it, del_it);
continue;
}

@ -85,13 +85,12 @@ class AorEntry : public unordered_map<string, RegBinding>
bindings_by_time.insert(it);
}
friend class AorHash;
public:
void erase(const iterator& it) {
bindings_by_time.erase(it);
unordered_map<string, RegBinding>::erase(it);
}
friend class AorHash;
};
struct AliasEntry
@ -188,6 +187,10 @@ public:
aor_it->second.set_expire(binding_it, expire);
}
void erase_binding(const iterator& aor_it, const AorEntry::iterator& binding_it) {
aor_it->second.erase(binding_it);
}
/* Maintenance stuff */
void gbc(long int now, list<string>& alias_list);

Loading…
Cancel
Save