Commit dea8b62b authored by Francis Dupont's avatar Francis Dupont
Browse files

[153-netconf-agent] Make netconf more robust

parent 14a9deda
...@@ -106,7 +106,7 @@ NetconfAgent::~NetconfAgent() { ...@@ -106,7 +106,7 @@ NetconfAgent::~NetconfAgent() {
void void
NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) { NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
if (NetconfProcess::global_shut_down_flag) { if (NetconfProcess::global_shut_down_flag || !cfg_mgr) {
return; return;
} }
const CfgServersMapPtr& servers = const CfgServersMapPtr& servers =
......
...@@ -47,10 +47,18 @@ NetconfProcess::run() { ...@@ -47,10 +47,18 @@ NetconfProcess::run() {
try { try {
// Initialize sysrepo. // Initialize sysrepo.
agent_.initSysrepo(); if (!shouldShutdown()) {
agent_.initSysrepo();
}
// Initialize netconf agent in a thread. // Initialize netconf agent in a thread.
Thread th([this]() { agent_.init(getNetconfCfgMgr()); }); NetconfCfgMgrPtr cfg_mgr;
if (!shouldShutdown()) {
cfg_mgr = getNetconfCfgMgr();
}
// Initialize the agent in a thread.
Thread th([cfg_mgr]() { 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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment