]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3721] addressed review comments
authorRazvan Becheriu <razvan@isc.org>
Mon, 27 Jan 2025 15:02:02 +0000 (17:02 +0200)
committerRazvan Becheriu <razvan@isc.org>
Mon, 27 Jan 2025 15:02:02 +0000 (17:02 +0200)
ChangeLog
src/bin/agent/ca_process.cc
src/lib/config/http_command_mgr.cc
src/lib/config/unix_command_mgr.cc

index 5f1365262f43e701b1d19033848fd595f6acb70a..83b0f5246502c8a9bf9a8453263bb3141bf69b73 100644 (file)
--- 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.
index c3a016afabe26f28df97ccab95a0c6288d787608..ec040b8287d90281ccd6969163e26e8679f68c26 100644 (file)
@@ -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()));
index a125eca54e57fb9286564e689ee2c98da8e30504..1856e6c521061ba32d28873eb532c979f18c435c 100644 (file)
@@ -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;
     }
index 560f4c39e042bb687c9d62383d653d1ac579b91f..a6931101b543c4453b07608c4f387c810ff11ad0 100644 (file)
@@ -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;
     }