diff --git a/ChangeLog b/ChangeLog index 5f1365262f..83b0f52465 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/src/bin/agent/ca_process.cc b/src/bin/agent/ca_process.cc index c3a016afab..ec040b8287 100644 --- a/src/bin/agent/ca_process.cc +++ b/src/bin/agent/ca_process.cc @@ -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 { @@ -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())); diff --git a/src/lib/config/http_command_mgr.cc b/src/lib/config/http_command_mgr.cc index a125eca54e..1856e6c521 100644 --- a/src/lib/config/http_command_mgr.cc +++ b/src/lib/config/http_command_mgr.cc @@ -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); } } @@ -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; } diff --git a/src/lib/config/unix_command_mgr.cc b/src/lib/config/unix_command_mgr.cc index 560f4c39e0..a6931101b5 100644 --- a/src/lib/config/unix_command_mgr.cc +++ b/src/lib/config/unix_command_mgr.cc @@ -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); } } @@ -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; }