]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3246] Cleanup in the comments
authorMarcin Siodelski <marcin@isc.org>
Fri, 26 Apr 2024 06:35:24 +0000 (08:35 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 19 Jun 2024 10:34:18 +0000 (12:34 +0200)
src/hooks/dhcp/high_availability/command_creator.cc
src/hooks/dhcp/high_availability/ha_service.cc
src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc
src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc

index 49710660281281c8e1b173d213d840fbfc8062aa..933a9228143e8b001b85eb59ff519a33dfc4461a 100644 (file)
@@ -149,8 +149,8 @@ CommandCreator::createLease6BulkApply(const Lease6CollectionPtr& leases,
     for (auto const& lease : *deleted_leases) {
         ElementPtr lease_as_json = lease->toElement();
         insertLeaseExpireTime(lease_as_json);
-        // If the deleted/released lease has zero lifetimes it means that
-        // it should be preserved in the database. It is treated as released
+        // If the deleted lease is in the released state it means that it
+        // should be preserved in the database. It is treated as released
         // but can be re-allocated to the same client later (lease affinity).
         // Such a lease should be updated by the partner rather than deleted.
         if (lease->state_ == Lease6::STATE_RELEASED) {
index 7847ef718ec8163b4097bd5bd6409f3c8200d1cb..b297858867d6f8d4ab62e59dfac300b74051f5c9 100644 (file)
@@ -1219,8 +1219,7 @@ HAService::asyncSendLeaseUpdates(const dhcp::Pkt4Ptr& query,
             // Lease updates for deleted leases.
             for (auto const& l : *deleted_leases) {
                 // If a released lease is preserved in the database send the lease
-                // update with the zero lifetime to the partner. Otherwise, delete
-                // the lease.
+                // update to the partner. Otherwise, delete the lease.
                 if (l->state_ == Lease4::STATE_RELEASED) {
                     lease_update_backlog_.push(LeaseUpdateBacklog::ADD, l);
                 } else {
@@ -1253,8 +1252,7 @@ HAService::asyncSendLeaseUpdates(const dhcp::Pkt4Ptr& query,
         // Lease updates for deleted leases.
         for (auto const& l : *deleted_leases) {
             // If a released lease is preserved in the database send the lease
-            // update with the zero lifetime to the partner. Otherwise, delete
-            // the lease.
+            // update to the partner. Otherwise, delete the lease.
             if (l->state_ == Lease4::STATE_RELEASED) {
                 asyncSendLeaseUpdate(query, conf, CommandCreator::createLease4Update(*l),
                                      parking_lot);
@@ -1313,8 +1311,7 @@ HAService::asyncSendLeaseUpdates(const dhcp::Pkt6Ptr& query,
         if (shouldQueueLeaseUpdates(conf)) {
             for (auto const& l : *deleted_leases) {
                 // If a released lease is preserved in the database send the lease
-                // update with the zero lifetime to the partner. Otherwise, delete
-                // the lease.
+                // update to the partner. Otherwise, delete the lease.
                 if (l->state_ == Lease4::STATE_RELEASED) {
                     lease_update_backlog_.push(LeaseUpdateBacklog::ADD, l);
                 } else {
index ac08966911ddf336bbffc807b6efc09832f4ee6b..fca0f4d9e1c99714b6799ed0cf88757c0726fd1b 100644 (file)
@@ -427,8 +427,8 @@ TEST(CommandCreatorTest, createLease6BulkApply) {
     EXPECT_EQ(leaseAsJson(lease)->str(), lease_as_json->str());
 }
 
-// This test verifies that the lease6-bulk-apply command is correct when
-// deleted leases have lifetimes of 0.
+// This test verifies that the lease6-bulk-apply command is correct
+// when sending a lease update for the lease in the relased state.
 TEST(CommandCreatorTest, createLease6BulkApplySoftDelete) {
     Lease6Ptr deleted_lease = createLease6();
     deleted_lease->valid_lft_ = 0;
@@ -455,8 +455,7 @@ TEST(CommandCreatorTest, createLease6BulkApplySoftDelete) {
     ASSERT_EQ(Element::list, deleted_leases_json->getType());
     EXPECT_EQ(0, deleted_leases_json->size());
 
-    // The lease with the valid lifetime of 0 should be in the updated
-    // leases list.
+    // The lease in the released state should be in the updated leases list.
     auto leases_json = arguments->get("leases");
     ASSERT_TRUE(leases_json);
     ASSERT_EQ(Element::list, leases_json->getType());
index 610efb7ed06417a6f76390ff140b99d6bb2581fe..be05601265f7d7c25629649f88364184abeabc97 100644 (file)
@@ -816,8 +816,7 @@ public:
     /// @param create_service a boolean flag indicating whether the test should
     /// re-create HA service and communication state.
     /// @param soft_delete_leases a boolean flag indicating that the test should simulate
-    /// soft release of leases, i.e., lease lifetime is set to 0 and the lease is not
-    /// deleted.
+    /// soft release of leases, i.e., lease state is released and the lease is not deleted.
     void testSendLeaseUpdates(std::function<void()> unpark_handler,
                               const bool should_fail,
                               const size_t num_updates,
@@ -936,8 +935,7 @@ public:
     /// @param create_service a boolean flag indicating whether the test should
     /// re-create HA service and communication state.
     /// @param soft_delete_leases a boolean flag indicating that the test should simulate
-    /// soft release of leases, i.e., lease lifetime is set to 0 and the lease is not
-    /// deleted.
+    /// soft release of leases, i.e., lease is released and the lease is not deleted.
     void testSendLeaseUpdates6(std::function<void()> unpark_handler,
                                const bool should_fail,
                                const size_t num_updates,
@@ -1160,9 +1158,8 @@ public:
         EXPECT_TRUE(delete_request3);
     }
 
-    /// @brief Tests scenarios when released leases have zero valid
-    /// lifetime and should be preserved in the partner's lease
-    /// database.
+    /// @brief Tests scenarios when released leases should be preserved
+    /// in the partner's lease database.
     void testSendSuccessfulUpdatesSoftDelete() {
         // Start HTTP servers.
         ASSERT_NO_THROW({
@@ -1682,9 +1679,8 @@ public:
         EXPECT_TRUE(update_request3);
     }
 
-    /// @brief Tests scenarios when released leases have zero valid
-    /// lifetime and should be preserved in the partner's lease
-    /// database.
+    /// @brief Tests scenarios when released leases should be preserved
+    /// in the partner's lease database.
     void testSendSuccessfulUpdates6SoftDelete() {
         // Start HTTP servers.
         ASSERT_NO_THROW({
@@ -2736,14 +2732,14 @@ TEST_F(HAServiceTest, sendSuccessfulUpdatesMultiThreading) {
     testSendSuccessfulUpdates();
 }
 
-// Tests scenarios when released leases have zero valid lifetime
-// and should be preserved in the partner's lease database.
+// Tests scenarios when released leases should be preserved in the
+/// partner's lease database.
 TEST_F(HAServiceTest, sendSuccessfulUpdatesSoftDelete) {
     testSendSuccessfulUpdatesSoftDelete();
 }
 
-// Tests scenarios when released leases are have zero valid lifetime
-// and should be preserved in the partner's lease database.
+// Tests scenarios when released leases should be preserved in the
+/// partner's lease database.
 TEST_F(HAServiceTest, sendSuccessfulUpdatesSoftDeleteMultiThreading) {
     MultiThreadingMgr::instance().setMode(true);
     testSendSuccessfulUpdatesSoftDelete();
index 1e6469658e7ab0089174162b31aa5c7519ab9d5d..c76a9deeff6c4aa4879dd56656ff384a772c87cc 100644 (file)
@@ -1249,8 +1249,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolSolicitNoHint) {
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
 
     AllocEngine engine(100);
-
-                                                                                                                                                     }
+}
 
 // Checks that a client gets the address reserved (in-pool case)
 // This test checks the behavior of the allocation engine in the following