From: Razvan Becheriu Date: Fri, 15 May 2020 17:27:19 +0000 (+0300) Subject: [#1227] addressed review X-Git-Tag: Kea-1.7.8~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9324da4d4cbf96c522a8738fcbc30ab7c197916;p=thirdparty%2Fkea.git [#1227] addressed review --- diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 18efcf8743..b2c744d17f 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -279,7 +279,7 @@ Dhcpv6Srv::~Dhcpv6Srv() { LeaseMgrFactory::destroy(); // Explicitly unload hooks - HooksManager::getHooksManager().unloadLibraries(); + HooksManager::unloadLibraries(); } void Dhcpv6Srv::shutdown() { diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index dc2e56f597..af25d3e222 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -1695,7 +1695,7 @@ AllocEngine::reuseExpiredLease(Lease6Ptr& expired, ClientContext6& ctx, // Let's execute all callouts registered for lease6_select if (ctx.callout_handle_ && - HooksManager::getHooksManager().calloutsPresent(hook_index_lease6_select_)) { + HooksManager::calloutsPresent(hook_index_lease6_select_)) { // Use the RAII wrapper to make sure that the callout handle state is // reset when this object goes out of scope. All hook points must do @@ -1811,7 +1811,7 @@ Lease6Ptr AllocEngine::createLease6(ClientContext6& ctx, // Let's execute all callouts registered for lease6_select if (ctx.callout_handle_ && - HooksManager::getHooksManager().calloutsPresent(hook_index_lease6_select_)) { + HooksManager::calloutsPresent(hook_index_lease6_select_)) { // Use the RAII wrapper to make sure that the callout handle state is // reset when this object goes out of scope. All hook points must do @@ -2287,7 +2287,7 @@ AllocEngine::reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeo // lease6_expire callouts installed. CalloutHandlePtr callout_handle; if (!leases.empty() && - HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease6_expire_)) { + HooksManager::calloutsPresent(Hooks.hook_index_lease6_expire_)) { callout_handle = HooksManager::createCalloutHandle(); } @@ -2425,7 +2425,7 @@ AllocEngine::reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeo // lease4_expire callouts installed. CalloutHandlePtr callout_handle; if (!leases.empty() && - HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease4_expire_)) { + HooksManager::calloutsPresent(Hooks.hook_index_lease4_expire_)) { callout_handle = HooksManager::createCalloutHandle(); } @@ -2726,7 +2726,7 @@ AllocEngine::reclaimDeclined(const Lease4Ptr& lease) { return (true); } - if (HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease4_recover_)) { + if (HooksManager::calloutsPresent(Hooks.hook_index_lease4_recover_)) { CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle(); // Use the RAII wrapper to make sure that the callout handle state is @@ -2780,7 +2780,7 @@ AllocEngine::reclaimDeclined(const Lease6Ptr& lease) { return (true); } - if (HooksManager::getHooksManager().calloutsPresent(Hooks.hook_index_lease6_recover_)) { + if (HooksManager::calloutsPresent(Hooks.hook_index_lease6_recover_)) { CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle(); // Use the RAII wrapper to make sure that the callout handle state is @@ -3653,7 +3653,7 @@ AllocEngine::createLease4(const ClientContext4& ctx, const IOAddress& addr, // Let's execute all callouts registered for lease4_select if (ctx.callout_handle_ && - HooksManager::getHooksManager().calloutsPresent(hook_index_lease4_select_)) { + HooksManager::calloutsPresent(hook_index_lease4_select_)) { // Use the RAII wrapper to make sure that the callout handle state is // reset when this object goes out of scope. All hook points must do @@ -3768,8 +3768,7 @@ AllocEngine::renewLease4(const Lease4Ptr& lease, bool skip = false; // Execute all callouts registered for lease4_renew. - if (HooksManager::getHooksManager(). - calloutsPresent(Hooks.hook_index_lease4_renew_)) { + if (HooksManager::calloutsPresent(Hooks.hook_index_lease4_renew_)) { // Use the RAII wrapper to make sure that the callout handle state is // reset when this object goes out of scope. All hook points must do @@ -3871,8 +3870,8 @@ AllocEngine::reuseExpiredLease4(Lease4Ptr& expired, .arg(expired->toText()); // Let's execute all callouts registered for lease4_select - if (ctx.callout_handle_ && HooksManager::getHooksManager() - .calloutsPresent(hook_index_lease4_select_)) { + if (ctx.callout_handle_ && + HooksManager::calloutsPresent(hook_index_lease4_select_)) { // Enable copying options from the packet within hook library. ScopedEnableOptionsCopy query4_options_copy(ctx.query_); diff --git a/src/lib/dhcpsrv/cb_ctl_dhcp4.cc b/src/lib/dhcpsrv/cb_ctl_dhcp4.cc index c64d655bdb..90bfce315e 100644 --- a/src/lib/dhcpsrv/cb_ctl_dhcp4.cc +++ b/src/lib/dhcpsrv/cb_ctl_dhcp4.cc @@ -209,7 +209,7 @@ CBControlDHCPv4::databaseConfigApply(const BackendSelector& backend_selector, LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_CONFIG4_MERGED); if (!audit_entries.empty() && - HooksManager::getHooksManager().calloutsPresent(hooks_.hook_index_cb4_updated_)) { + HooksManager::calloutsPresent(hooks_.hook_index_cb4_updated_)) { CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle(); // Use the RAII wrapper to make sure that the callout handle state is diff --git a/src/lib/dhcpsrv/cb_ctl_dhcp6.cc b/src/lib/dhcpsrv/cb_ctl_dhcp6.cc index 0ad5eb09f9..7e83175e9c 100644 --- a/src/lib/dhcpsrv/cb_ctl_dhcp6.cc +++ b/src/lib/dhcpsrv/cb_ctl_dhcp6.cc @@ -208,7 +208,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_CONFIG6_MERGED); if (!audit_entries.empty() && - HooksManager::getHooksManager().calloutsPresent(hooks_.hook_index_cb6_updated_)) { + HooksManager::calloutsPresent(hooks_.hook_index_cb6_updated_)) { CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle(); // Use the RAII wrapper to make sure that the callout handle state is diff --git a/src/lib/hooks/hooks_manager.h b/src/lib/hooks/hooks_manager.h index 911d8af741..5d1f9e9c41 100644 --- a/src/lib/hooks/hooks_manager.h +++ b/src/lib/hooks/hooks_manager.h @@ -37,10 +37,6 @@ class LibraryManagerCollection; class HooksManager : boost::noncopyable { public: - /// @brief Get singleton hooks manager - /// - /// @return Reference to the singleton hooks manager. - static HooksManager& getHooksManager(); /// @brief Load and reload libraries /// @@ -333,6 +329,11 @@ private: /// through the getHooksManager() static method. HooksManager(); + /// @brief Get singleton hooks manager + /// + /// @return Reference to the singleton hooks manager. + static HooksManager& getHooksManager(); + /// @brief Park an object (packet). /// /// @tparam Type of the parked object. diff --git a/src/lib/hooks/library_handle.cc b/src/lib/hooks/library_handle.cc index 6593febc5b..da6ec25c29 100644 --- a/src/lib/hooks/library_handle.cc +++ b/src/lib/hooks/library_handle.cc @@ -72,7 +72,7 @@ LibraryHandle::deregisterAllCallouts(const std::string& name) { isc::data::ConstElementPtr LibraryHandle::getParameters() { - HookLibsCollection libinfo = HooksManager::getHooksManager().getLibraryInfo(); + HookLibsCollection libinfo = HooksManager::getLibraryInfo(); int index = index_;