mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 06:55:16 +00:00
[153-netconf-agent] Revamp the init thread
This commit is contained in:
@@ -53,7 +53,10 @@ public:
|
|||||||
/// Load Kea server configurations from YANG datastore.
|
/// Load Kea server configurations from YANG datastore.
|
||||||
/// Subscribe changes in 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);
|
void init(NetconfCfgMgrPtr cfg_mgr);
|
||||||
|
|
||||||
/// @brief Clear.
|
/// @brief Clear.
|
||||||
|
@@ -46,19 +46,28 @@ NetconfProcess::run() {
|
|||||||
LOG_INFO(netconf_logger, NETCONF_STARTED).arg(VERSION);
|
LOG_INFO(netconf_logger, NETCONF_STARTED).arg(VERSION);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Initialize sysrepo.
|
|
||||||
if (!shouldShutdown()) {
|
|
||||||
agent_.initSysrepo();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize netconf agent in a thread.
|
// Initialize netconf agent in a thread.
|
||||||
NetconfCfgMgrPtr cfg_mgr;
|
Thread th([this]() {
|
||||||
if (!shouldShutdown()) {
|
if (shouldShutdown()) {
|
||||||
cfg_mgr = getNetconfCfgMgr();
|
return;
|
||||||
}
|
}
|
||||||
|
// Initialize sysrepo.
|
||||||
|
agent_.initSysrepo();
|
||||||
|
if (shouldShutdown()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the agent in a thread.
|
// Get the configuration manager.
|
||||||
Thread th([this, cfg_mgr]() { agent_.init(cfg_mgr); });
|
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
|
// Let's process incoming data or expiring timers in a loop until
|
||||||
// shutdown condition is detected.
|
// shutdown condition is detected.
|
||||||
|
Reference in New Issue
Block a user