/// 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.
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();
- }
-
- // Initialize the agent in a thread.
- Thread th([this, cfg_mgr]() { agent_.init(cfg_mgr); });
+ Thread th([this]() {
+ if (shouldShutdown()) {
+ return;
+ }
+ // Initialize sysrepo.
+ agent_.initSysrepo();
+ if (shouldShutdown()) {
+ return;
+ }
+
+ // 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.