Skip to content

Commit

Permalink
[#3721] addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Razvan Becheriu committed Jan 27, 2025
1 parent 0f001c1 commit df35252
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The kea-dhcp4, kea-dhcp6 and kea-dhcp-ddns servers now support
multiple http/https connections. The can be configured in the
"control-sockets" list.
(Gitlab #3082)
(Gitlab #3082, #3721)

2315. [func] razvan
Kea can now load hook libraries specifying only the binary name.
Expand Down
5 changes: 5 additions & 0 deletions src/bin/agent/ca_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
.arg(server_port);
}
}
// If the connection can be reused, mark it as usable.
it->second->usable_ = true;
} else {

Expand Down Expand Up @@ -210,8 +211,12 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
auto copy = sockets_;
for (auto const& data : copy) {
if (data.second->usable_) {
// If the connection can be used (just created) or reused, keep it
// in the list and clear the flag. It will be marked again on next
// configuration event if needed.
data.second->usable_ = false;
} else {
// If the connection can not be reused, stop it and remove it from the list.
data.second->listener_->stop();
auto it = sockets_.find(std::make_pair(data.second->config_->getHttpHost(),
data.second->config_->getHttpPort()));
Expand Down
5 changes: 5 additions & 0 deletions src/lib/config/http_command_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ HttpCommandMgrImpl::openCommandSockets(const isc::data::ConstElementPtr config)
auto copy = sockets_;
for (auto const& data : copy) {
if (data.second->usable_) {
// If the connection can be used (just created) or reused, keep it
// in the list and clear the flag. It will be marked again on next
// configuration event if needed.
data.second->usable_ = false;
} else {
// If the connection can not be reused, stop it and remove it from the list.
closeCommandSocket(data.second, true);
}
}
Expand Down Expand Up @@ -133,6 +137,7 @@ HttpCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
it->second->config_->setAuthConfig(cmd_config->getAuthConfig());
it->second->config_->setEmulateAgentResponse(cmd_config->getEmulateAgentResponse());
}
// If the connection can be reused, mark it as usable.
it->second->usable_ = true;
return;
}
Expand Down
5 changes: 5 additions & 0 deletions src/lib/config/unix_command_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,12 @@ UnixCommandMgrImpl::openCommandSockets(const isc::data::ConstElementPtr config)
auto copy = sockets_;
for (auto const& data : copy) {
if (data.second->usable_) {
// If the connection can be used (just created) or reused, keep it
// in the list and clear the flag. It will be marked again on next
// configuration event if needed.
data.second->usable_ = false;
} else {
// If the connection can not be reused, stop it and remove it from the list.
closeCommandSocket(data.second);
}
}
Expand All @@ -592,6 +596,7 @@ UnixCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
// Search for the specific connection and reuse the existing one if found.
auto it = sockets_.find(cmd_config->getSocketName());
if (it != sockets_.end()) {
// If the connection can be reused, mark it as usable.
it->second->usable_ = true;
return;
}
Expand Down

0 comments on commit df35252

Please sign in to comment.