fixes add entry issue

This commit is contained in:
Jacopo Bartiromo 2020-09-03 16:46:54 +02:00 committed by bernat
parent 32721d951f
commit 318681e276
1 changed files with 6 additions and 1 deletions

View File

@ -27,7 +27,12 @@ namespace traffic_manager {
void AddEntry(const std::pair<Key, Value> &entry) {
std::lock_guard<std::mutex> lock(map_mutex);
map.insert(entry);
const Key& key = entry.first;
if (map.find(key) != map.end()) {
map.at(key) = entry.second;
} else {
map.insert(entry);
}
}
bool Contains(const Key &key) const {