]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3110] Post rebase corrections
authorThomas Markwalder <tmark@isc.org>
Fri, 1 Dec 2023 16:48:00 +0000 (11:48 -0500)
committerThomas Markwalder <tmark@isc.org>
Fri, 1 Dec 2023 16:48:00 +0000 (11:48 -0500)
src/hooks/dhcp/high_availability/ha_impl.cc
src/hooks/dhcp/high_availability/tests/ha_impl_unittest.cc

index c5c41afea96ebdfb2d36e141fac32b22b9c8a208..a09ee5d679f3923ab28c32db5b7251d5a9ef0773 100644 (file)
@@ -194,7 +194,7 @@ HAImpl::lease4ServerDecline(CalloutHandle& callout_handle) {
     // If the hook library is configured to not send lease updates to the
     // partner, there is nothing to do because this whole callout is
     // currently about sending lease updates.
-    if (!config_->amSendingLeaseUpdates()) {
+    if (!config_->get()->amSendingLeaseUpdates()) {
         // No need to log it, because it was already logged when configuration
         // was applied.
         callout_handle.setArgument("peers_to_update", peers_to_update);
@@ -214,7 +214,7 @@ HAImpl::lease4ServerDecline(CalloutHandle& callout_handle) {
     // Asynchronously send the lease update. In some cases no updates will be sent,
     // e.g. when this server is in the partner-down state and there are no backup
     // servers.
-    peers_to_update = service_->asyncSendSingleLeaseUpdate(query4, lease4, 0);
+    peers_to_update = services_->get()->asyncSendSingleLeaseUpdate(query4, lease4, 0);
     callout_handle.setArgument("peers_to_update", peers_to_update);
 }
 
index d18b3d1ee34a11224e82fce20619745f3048e89d..fe67f70511b3df2f9ac938c8a8b783481eb16eab 100644 (file)
@@ -1294,13 +1294,17 @@ TEST_F(HAImplTest, haScopesBadServerName) {
 TEST_F(HAImplTest, lease4ServerDecline) {
     // Create implementation object and configure it.
     TestHAImpl ha_impl;
-    ASSERT_NO_THROW(ha_impl.startService(io_service_, network_state,
-                                         HAServerType::DHCPv4));
+    ASSERT_NO_THROW(ha_impl.configure(createValidJsonConfiguration()));
+
+    // Starting the service is required prior to running any callouts.
+    NetworkStatePtr network_state(new NetworkState(NetworkState::DHCPv4));
+    ASSERT_NO_THROW(ha_impl.startServices(io_service_, network_state,
+                                          HAServerType::DHCPv4));
 
     // Make sure we wait for the acks from the backup server to be able to
     // test the case of sending lease updates even though the service is
     // in the state in which the lease updates are normally not sent.
-    ha_impl.config_->setWaitBackupAck(true);
+    ha_impl.config_->get()->setWaitBackupAck(true);
 
     // Create callout handle to be used for passing arguments to the
     // callout.
@@ -1325,7 +1329,7 @@ TEST_F(HAImplTest, lease4ServerDecline) {
     // Set initial status.
     callout_handle->setStatus(CalloutHandle::NEXT_STEP_CONTINUE);
 
-    ha_impl.config_->setSendLeaseUpdates(false);
+    ha_impl.config_->get()->setSendLeaseUpdates(false);
 
     // Run the callout.
     ASSERT_NO_THROW(ha_impl.lease4ServerDecline(*callout_handle));
@@ -1338,7 +1342,7 @@ TEST_F(HAImplTest, lease4ServerDecline) {
     EXPECT_EQ(peers_to_update, 0);
 
     // Enable updates and retry.
-    ha_impl.config_->setSendLeaseUpdates(true);
+    ha_impl.config_->get()->setSendLeaseUpdates(true);
     callout_handle->setArgument("lease4", lease4);
 
     // Run the callout again.