2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#1188] stop thread pool when applying configuration and use multi threading critical section on libreload

This commit is contained in:
Razvan Becheriu
2020-04-24 11:38:05 +03:00
parent 1005ce538f
commit 454fd5bd35
2 changed files with 21 additions and 9 deletions

View File

@@ -229,6 +229,8 @@ ControlledDhcpv4Srv::commandShutdownHandler(const string&, ConstElementPtr args)
ConstElementPtr
ControlledDhcpv4Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
// pause dhcp service when reloading libraries
MultiThreadingCriticalSection cs;
/// @todo delete any stored CalloutHandles referring to the old libraries
/// Get list of currently loaded libraries and reload them.
HookLibsCollection loaded = HooksManager::getLibraryInfo();
@@ -352,6 +354,9 @@ ControlledDhcpv4Srv::commandConfigSetHandler(const string&,
return (result);
}
// disable multi-threading (it will be applied by new configuration)
MultiThreadingMgr::instance().apply(false, 0, 0);
// We are starting the configuration process so we should remove any
// staging configuration that has been created during previous
// configuration attempts.
@@ -713,9 +718,10 @@ ControlledDhcpv4Srv::processCommand(const string& command,
} else if (command == "status-get") {
return (srv->commandStatusGetHandler(command, args));
}
ConstElementPtr answer = isc::config::createAnswer(1,
"Unrecognized command:" + command);
return (answer);
return (isc::config::createAnswer(1, "Unrecognized command:"
+ command));
} catch (const Exception& ex) {
return (isc::config::createAnswer(1, "Error while processing command '"
+ command + "':" + ex.what() +

View File

@@ -232,6 +232,8 @@ ControlledDhcpv6Srv::commandShutdownHandler(const string&, ConstElementPtr args)
ConstElementPtr
ControlledDhcpv6Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
// pause dhcp service when reloading libraries
MultiThreadingCriticalSection cs;
/// @todo delete any stored CalloutHandles referring to the old libraries
/// Get list of currently loaded libraries and reload them.
HookLibsCollection loaded = HooksManager::getLibraryInfo();
@@ -355,6 +357,9 @@ ControlledDhcpv6Srv::commandConfigSetHandler(const string&,
return (result);
}
// disable multi-threading (it will be applied by new configuration)
MultiThreadingMgr::instance().apply(false, 0, 0);
// We are starting the configuration process so we should remove any
// staging configuration that has been created during previous
// configuration attempts.
@@ -665,7 +670,7 @@ ControlledDhcpv6Srv::processCommand(const string& command,
if (!srv) {
ConstElementPtr no_srv = isc::config::createAnswer(1,
"Server object not initialized, can't process command '" +
"Server object not initialized, so can't process command '" +
command + "', arguments: '" + txt + "'.");
return (no_srv);
}
@@ -722,7 +727,8 @@ ControlledDhcpv6Srv::processCommand(const string& command,
} catch (const Exception& ex) {
return (isc::config::createAnswer(1, "Error while processing command '"
+ command + "':" + ex.what()));
+ command + "':" + ex.what() +
", params: '" + txt + "'"));
}
}