From: Marcin Siodelski Date: Fri, 26 Apr 2024 06:35:24 +0000 (+0200) Subject: [#3246] Cleanup in the comments X-Git-Tag: Kea-2.7.0~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=849813fbdd81138862acf5d3cfb44f9a014343d7;p=thirdparty%2Fkea.git [#3246] Cleanup in the comments --- diff --git a/src/hooks/dhcp/high_availability/command_creator.cc b/src/hooks/dhcp/high_availability/command_creator.cc index 4971066028..933a922814 100644 --- a/src/hooks/dhcp/high_availability/command_creator.cc +++ b/src/hooks/dhcp/high_availability/command_creator.cc @@ -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) { diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index 7847ef718e..b297858867 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -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 { diff --git a/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc b/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc index ac08966911..fca0f4d9e1 100644 --- a/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc @@ -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()); diff --git a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc index 610efb7ed0..be05601265 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc @@ -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 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 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(); diff --git a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc index 1e6469658e..c76a9deeff 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc @@ -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