From: Marcin Siodelski Date: Wed, 29 Mar 2023 06:44:29 +0000 (+0200) Subject: [#2780] Moved the allocator initialization X-Git-Tag: Kea-2.3.7~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba529630d5292a981f3b1cc9a837dd952d7c0488;p=thirdparty%2Fkea.git [#2780] Moved the allocator initialization The FLQ allocation state is now populated before enabling MT. It was suggested in the review. --- diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index b6981bf1b3..ffdb4250a5 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -1082,9 +1082,6 @@ ControlledDhcpv4Srv::finishConfigHookLibraries(isc::data::ConstElementPtr config } } - return (ConstElementPtr()); - } - // Initialize the allocators. If the user selected a Free Lease Queue Allocator // for any of the subnets, the server will now populate free leases to the queue. // It may take a while! @@ -1094,6 +1091,20 @@ ControlledDhcpv4Srv::finishConfigHookLibraries(isc::data::ConstElementPtr config } catch (const std::exception& ex) { err << "Error initializing the lease allocators: " << ex.what(); + } + + // Apply multi threading settings. + // @note These settings are applied/updated only if no errors occur while + // applying the new configuration. + // @todo This should be fixed. + try { + CfgMultiThreading::apply(CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading()); + } catch (const std::exception& ex) { + err << "Error applying multi threading settings: " + << ex.what(); + return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); + } + return (ConstElementPtr()); } isc::data::ConstElementPtr diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index f5702ed23a..847671db13 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -1101,7 +1101,6 @@ ControlledDhcpv6Srv::finishConfigHookLibraries(isc::data::ConstElementPtr config } } - return (ConstElementPtr()); // Initialize the allocators. If the user selected a Free Lease Queue Allocator // for any of the subnets, the server will now populate free leases to the queue. // It may take a while! @@ -1112,6 +1111,18 @@ ControlledDhcpv6Srv::finishConfigHookLibraries(isc::data::ConstElementPtr config err << "Error initializing the lease allocators: " << ex.what(); } + // Apply multi threading settings. + // @note These settings are applied/updated only if no errors occur while + // applying the new configuration. + // @todo This should be fixed. + try { + CfgMultiThreading::apply(CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading()); + } catch (const std::exception& ex) { + err << "Error applying multi threading settings: " + << ex.what(); + return (isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str())); + } + return (ConstElementPtr()); } isc::data::ConstElementPtr