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:
@@ -229,6 +229,8 @@ ControlledDhcpv4Srv::commandShutdownHandler(const string&, ConstElementPtr args)
|
|||||||
|
|
||||||
ConstElementPtr
|
ConstElementPtr
|
||||||
ControlledDhcpv4Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
|
ControlledDhcpv4Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
|
||||||
|
// pause dhcp service when reloading libraries
|
||||||
|
MultiThreadingCriticalSection cs;
|
||||||
/// @todo delete any stored CalloutHandles referring to the old libraries
|
/// @todo delete any stored CalloutHandles referring to the old libraries
|
||||||
/// Get list of currently loaded libraries and reload them.
|
/// Get list of currently loaded libraries and reload them.
|
||||||
HookLibsCollection loaded = HooksManager::getLibraryInfo();
|
HookLibsCollection loaded = HooksManager::getLibraryInfo();
|
||||||
@@ -352,6 +354,9 @@ ControlledDhcpv4Srv::commandConfigSetHandler(const string&,
|
|||||||
return (result);
|
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
|
// We are starting the configuration process so we should remove any
|
||||||
// staging configuration that has been created during previous
|
// staging configuration that has been created during previous
|
||||||
// configuration attempts.
|
// configuration attempts.
|
||||||
@@ -662,8 +667,8 @@ ControlledDhcpv4Srv::processCommand(const string& command,
|
|||||||
|
|
||||||
if (!srv) {
|
if (!srv) {
|
||||||
ConstElementPtr no_srv = isc::config::createAnswer(1,
|
ConstElementPtr no_srv = isc::config::createAnswer(1,
|
||||||
"Server object not initialized, so can't process command '" +
|
"Server object not initialized, so can't process command '" +
|
||||||
command + "', arguments: '" + txt + "'.");
|
command + "', arguments: '" + txt + "'.");
|
||||||
return (no_srv);
|
return (no_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,9 +718,10 @@ ControlledDhcpv4Srv::processCommand(const string& command,
|
|||||||
} else if (command == "status-get") {
|
} else if (command == "status-get") {
|
||||||
return (srv->commandStatusGetHandler(command, args));
|
return (srv->commandStatusGetHandler(command, args));
|
||||||
}
|
}
|
||||||
ConstElementPtr answer = isc::config::createAnswer(1,
|
|
||||||
"Unrecognized command:" + command);
|
return (isc::config::createAnswer(1, "Unrecognized command:"
|
||||||
return (answer);
|
+ command));
|
||||||
|
|
||||||
} catch (const Exception& ex) {
|
} catch (const Exception& ex) {
|
||||||
return (isc::config::createAnswer(1, "Error while processing command '"
|
return (isc::config::createAnswer(1, "Error while processing command '"
|
||||||
+ command + "':" + ex.what() +
|
+ command + "':" + ex.what() +
|
||||||
|
@@ -227,11 +227,13 @@ ControlledDhcpv6Srv::commandShutdownHandler(const string&, ConstElementPtr args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ControlledDhcpv6Srv::getInstance()->shutdownServer(exit_value);
|
ControlledDhcpv6Srv::getInstance()->shutdownServer(exit_value);
|
||||||
return(createAnswer(CONTROL_RESULT_SUCCESS, "Shutting down."));
|
return (createAnswer(CONTROL_RESULT_SUCCESS, "Shutting down."));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstElementPtr
|
ConstElementPtr
|
||||||
ControlledDhcpv6Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
|
ControlledDhcpv6Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
|
||||||
|
// pause dhcp service when reloading libraries
|
||||||
|
MultiThreadingCriticalSection cs;
|
||||||
/// @todo delete any stored CalloutHandles referring to the old libraries
|
/// @todo delete any stored CalloutHandles referring to the old libraries
|
||||||
/// Get list of currently loaded libraries and reload them.
|
/// Get list of currently loaded libraries and reload them.
|
||||||
HookLibsCollection loaded = HooksManager::getLibraryInfo();
|
HookLibsCollection loaded = HooksManager::getLibraryInfo();
|
||||||
@@ -355,6 +357,9 @@ ControlledDhcpv6Srv::commandConfigSetHandler(const string&,
|
|||||||
return (result);
|
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
|
// We are starting the configuration process so we should remove any
|
||||||
// staging configuration that has been created during previous
|
// staging configuration that has been created during previous
|
||||||
// configuration attempts.
|
// configuration attempts.
|
||||||
@@ -665,8 +670,8 @@ ControlledDhcpv6Srv::processCommand(const string& command,
|
|||||||
|
|
||||||
if (!srv) {
|
if (!srv) {
|
||||||
ConstElementPtr no_srv = isc::config::createAnswer(1,
|
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 + "'.");
|
command + "', arguments: '" + txt + "'.");
|
||||||
return (no_srv);
|
return (no_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,7 +727,8 @@ ControlledDhcpv6Srv::processCommand(const string& command,
|
|||||||
|
|
||||||
} catch (const Exception& ex) {
|
} catch (const Exception& ex) {
|
||||||
return (isc::config::createAnswer(1, "Error while processing command '"
|
return (isc::config::createAnswer(1, "Error while processing command '"
|
||||||
+ command + "':" + ex.what()));
|
+ command + "':" + ex.what() +
|
||||||
|
", params: '" + txt + "'"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user