fixes add entry issue
This commit is contained in:
parent
32721d951f
commit
318681e276
|
@ -27,7 +27,12 @@ namespace traffic_manager {
|
||||||
void AddEntry(const std::pair<Key, Value> &entry) {
|
void AddEntry(const std::pair<Key, Value> &entry) {
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(map_mutex);
|
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 {
|
bool Contains(const Key &key) const {
|
||||||
|
|
Loading…
Reference in New Issue