2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[676-add-support-for-server-tags-in-the-cb_cmds-hooks-library] Addressed comments

This commit is contained in:
Francis Dupont 2019-06-29 15:31:19 +02:00
parent 2840515b1f
commit 06826b5e5c
2 changed files with 8 additions and 12 deletions

View File

@ -188,6 +188,7 @@ TestConfigBackendDHCPv4::getModifiedOptions4(const db::ServerSelector& /* server
StampedValuePtr
TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_selector,
const std::string& name) const {
auto candidate = StampedValuePtr();
const auto& index = globals_.get<StampedValueNameIndexTag>();
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
@ -196,16 +197,13 @@ TestConfigBackendDHCPv4::getGlobalParameter4(const db::ServerSelector& server_se
for (auto tag : tags) {
if ((*global_it)->hasServerTag(ServerTag(tag))) {
return (*global_it);
} else if ((*global_it)->hasAllServerTag()) {
candidate = *global_it;
}
}
}
auto global_all_it = index.find(name);
if ((global_all_it != index.end()) && ((*global_all_it)->hasAllServerTag())) {
return (*global_all_it);
}
return (StampedValuePtr());
return (candidate);
}

View File

@ -187,6 +187,7 @@ TestConfigBackendDHCPv6::getModifiedOptions6(const db::ServerSelector& /* server
StampedValuePtr
TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_selector,
const std::string& name) const {
auto candidate = StampedValuePtr();
const auto& index = globals_.get<StampedValueNameIndexTag>();
auto global_range = index.equal_range(name);
for (auto global_it = global_range.first; global_it != global_range.second;
@ -196,15 +197,12 @@ TestConfigBackendDHCPv6::getGlobalParameter6(const db::ServerSelector& server_se
if ((*global_it)->hasServerTag(ServerTag(tag))) {
return (*global_it);
}
} else if ((*global_it)->hasAllServerTag()) {
candidate = *global_it;
}
}
auto global_all_it = index.find(name);
if ((global_all_it != index.end()) && ((*global_all_it)->hasAllServerTag())) {
return (*global_all_it);
}
return (StampedValuePtr());
return (candidate);
}