]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[153-netconf-agent] Updates (include !94)
authorFrancis Dupont <fdupont@isc.org>
Tue, 23 Oct 2018 18:08:37 +0000 (20:08 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 30 Oct 2018 11:50:38 +0000 (07:50 -0400)
src/bin/netconf/netconf.cc
src/bin/netconf/tests/netconf_unittests.cc

index 9780109278aaa4ace23dfec5cd6acfbe46257221..e560384f39fb16872e67f88de53d92033b3b8eb5 100644 (file)
@@ -106,6 +106,9 @@ NetconfAgent::~NetconfAgent() {
 
 void
 NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
+    if (NetconfProcess::global_shut_down_flag) {
+        return;
+    }
     const CfgServersMapPtr& servers =
         cfg_mgr->getNetconfConfig()->getCfgServersMap();
     for (auto pair : *servers) {
@@ -113,11 +116,17 @@ NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
             return;
         }
         keaConfig(pair);
+        if (NetconfProcess::global_shut_down_flag) {
+            return;
+        }
     }
     if (NetconfProcess::global_shut_down_flag) {
         return;
     }
     initSysrepo();
+    if (NetconfProcess::global_shut_down_flag) {
+        return;
+    }
     for (auto pair : *servers) {
         if (NetconfProcess::global_shut_down_flag) {
             return;
@@ -127,6 +136,9 @@ NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
             return;
         }
         subscribe(pair);
+        if (NetconfProcess::global_shut_down_flag) {
+            return;
+        }
     }
 }
 
index 62239258d779c2c1b27c69d9e56e6886afda3c50..5d2aab0656d7987cc1a3158c2c9b258de5fd74b4 100644 (file)
@@ -144,12 +144,12 @@ public:
     /// @brief Destructor.
     virtual ~NetconfAgentTest() {
         NetconfProcess::global_shut_down_flag = true;
-        io_service_->stop();
-        io_service_.reset();
         if (thread_) {
             thread_->wait();
             thread_.reset();
         }
+        io_service_->stop();
+        io_service_.reset();
         if (agent_) {
             clearYang(agent_);
             agent_->clear();
@@ -230,12 +230,12 @@ public:
     /// @brief Destructor.
     virtual ~NetconfAgentLogTest() {
         NetconfProcess::global_shut_down_flag = true;
-        io_service_->stop();
-        io_service_.reset();
         if (thread_) {
             thread_->wait();
             thread_.reset();
         }
+        io_service_->stop();
+        io_service_.reset();
         if (agent_) {
             clearYang(agent_);
             agent_->clear();
@@ -822,7 +822,7 @@ TEST_F(NetconfAgentTest, subscribe) {
     EXPECT_NO_THROW(agent_->subscriptions_.clear());
 }
 
-/// Verifies the update method works as expected: apply new YNAG configuration
+/// Verifies the update method works as expected: apply new YANG configuration
 /// to the server. Note it is called by the subscription callback.
 TEST_F(NetconfAgentTest, update) {
     // Initial YANG configuration.
@@ -963,7 +963,7 @@ TEST_F(NetconfAgentTest, update) {
     EXPECT_TRUE(expected->equals(*pruned));
 }
 
-/// Verifies the validate method works as expected: test new YNAG configuration
+/// Verifies the validate method works as expected: test new YANG configuration
 /// with the server. Note it is called by the subscription callback and
 /// update is called after.
 TEST_F(NetconfAgentTest, validate) {