Commit ba83c314 authored by Francis Dupont's avatar Francis Dupont

[#1282] Addressed comments

parent 12640be3
// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -121,6 +121,12 @@ void Dhcp4to6Ipc::handler(int /* fd */) {
// Delete previously set arguments
callout_handle->deleteAllArguments();
// 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
// it to prevent possible circular dependency between the callout
// handle and its arguments.
ScopedCalloutHandleState callout_handle_state(callout_handle);
// Enable copying options from the packet within hook library.
ScopedEnableOptionsCopy<Pkt4> response4_options_copy(rsp);
......
......@@ -122,7 +122,6 @@ public:
/// @brief destructor (deletes Dhcpv4Srv)
virtual ~HooksDhcpv4SrvTest() {
// clear static buffers
resetCalloutBuffers();
......
......@@ -841,10 +841,10 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
// This occurs last as if it succeeds, there is no easy way to
// revert it. As a result, the failure to commit a subsequent
// change causes problems when trying to roll back.
const HooksConfig& libraries =
CfgMgr::instance().getStagingCfg()->getHooksConfig();
HooksManager::prepareUnloadLibraries();
static_cast<void>(HooksManager::unloadLibraries());
const HooksConfig& libraries =
CfgMgr::instance().getStagingCfg()->getHooksConfig();
libraries.loadLibraries();
}
catch (const isc::Exception& ex) {
......
......@@ -86,7 +86,7 @@ public:
/// library manager collection) the method will fail to close
/// libraries and returns false. It is a fatal error as there
/// is no possible recovery. It is a logic error in the hook
/// code too so the solution is to fix the it and to restart
/// code too so the solution is to fix it and to restart
/// the server with a correct hook library binary.
///
/// @return true if all libraries unloaded successfully, false if they
......@@ -95,7 +95,7 @@ public:
/// @brief Prepare the unloading of libraries
///
/// Calls the unload functions when they exists and removes callouts.
/// Calls the unload functions when they exist and removes callouts.
///
/// @note: after the call to this method there should be no visible
/// dangling pointers (i.e. callout handles owning the library
......
......@@ -52,7 +52,7 @@ LibraryManagerCollection::LibraryManagerCollection(const HookLibsCollection& lib
bool
LibraryManagerCollection::loadLibraries() {
// There must be not libraries still in memory.
// There must be no libraries still in memory.
if (!lib_managers_.empty()) {
isc_throw(LibrariesStillOpened, "some libraries are still opened");
}
......
......@@ -604,8 +604,8 @@ TEST_F(LibraryManagerTest, LoadLibraryWrongVersion) {
// Check that the full loadLibrary call works.
TEST_F(LibraryManagerTest, LoadLibrary) {
PublicLibraryManager lib_manager(std::string(FULL_CALLOUT_LIBRARY), 0,
callout_manager_);
PublicLibraryManager lib_manager(std::string(FULL_CALLOUT_LIBRARY), 0,
callout_manager_);
EXPECT_TRUE(lib_manager.loadLibrary());
// Now execute the callouts in the order expected. The library performs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment