2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[153-netconf-agent] Revamp the init thread

This commit is contained in:
Francis Dupont
2018-10-25 23:54:04 +02:00
parent eff4bbda69
commit 0c7dca543a
2 changed files with 24 additions and 12 deletions

View File

@@ -53,7 +53,10 @@ public:
/// Load Kea server configurations from YANG datastore.
/// Subscribe changes in YANG datastore.
///
/// @param cfg_mgr The configuration manager.
/// If @c NetconfProcess::global_shut_down_flag becomes true
/// returns as soon as possible.
///
/// @param cfg_mgr The configuration manager (can be null).
void init(NetconfCfgMgrPtr cfg_mgr);
/// @brief Clear.

View File

@@ -46,19 +46,28 @@ NetconfProcess::run() {
LOG_INFO(netconf_logger, NETCONF_STARTED).arg(VERSION);
try {
// Initialize sysrepo.
if (!shouldShutdown()) {
agent_.initSysrepo();
}
// Initialize netconf agent in a thread.
NetconfCfgMgrPtr cfg_mgr;
if (!shouldShutdown()) {
cfg_mgr = getNetconfCfgMgr();
}
Thread th([this]() {
if (shouldShutdown()) {
return;
}
// Initialize sysrepo.
agent_.initSysrepo();
if (shouldShutdown()) {
return;
}
// Initialize the agent in a thread.
Thread th([this, cfg_mgr]() { agent_.init(cfg_mgr); });
// Get the configuration manager.
NetconfCfgMgrPtr cfg_mgr;
if (shouldShutdown()) {
return;
} else {
cfg_mgr = getNetconfCfgMgr();
}
// Call init.
agent_.init(cfg_mgr);
});
// Let's process incoming data or expiring timers in a loop until
// shutdown condition is detected.