From dd8ebba8d5f4f48299c137552131c0020ce5b58e Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Tue, 5 Mar 2024 09:51:03 +0100 Subject: [PATCH] [#2692] Checkpoint: code done, need UT --- src/bin/dhcp4/ctrl_dhcp4_srv.cc | 10 ++++++++++ src/bin/dhcp6/ctrl_dhcp6_srv.cc | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 90dc449964..ed0278fa8b 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -1077,6 +1077,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) { } catch (const std::exception& ex) { err << "Error initializing the lease allocators: " << ex.what(); + return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); } // Apply multi threading settings. @@ -1091,6 +1092,15 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) { return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); } + /// Let postponed hook initializations to run. + try { + ControlledDhcpv4Srv::getInstance()->getIOService()->poll(); + } catch (const std::exception& ex) { + err << "Error initializing hooks: " + << ex.what(); + return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); + } + return (answer); } diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index fe4200a682..cda7f8b87b 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -1095,7 +1095,9 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) { CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->initAllocatorsAfterConfigure(); } catch (const std::exception& ex) { - err << "Error initializing the lease allocators: " << ex.what(); + err << "Error initializing the lease allocators: " + << ex.what(); + return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); } // Apply multi threading settings. @@ -1110,6 +1112,15 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) { return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); } + /// Let postponed hook initializations to run. + try { + ControlledDhcpv6Srv::getInstance()->getIOService()->poll(); + } catch (const std::exception& ex) { + err << "Error initializing hooks: " + << ex.what(); + return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); + } + return (answer); } -- 2.47.3