]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[128-netconf-use-libprocess] Adopted runIO() which of course will be extended
authorFrancis Dupont <fdupont@isc.org>
Fri, 28 Sep 2018 10:45:20 +0000 (12:45 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 28 Sep 2018 10:45:20 +0000 (12:45 +0200)
src/bin/netconf/netconf_process.cc
src/bin/netconf/netconf_process.h

index fc233640eb310a14a59b0317f422c199e61b23c0..b6e6e8feea7e36612e2a3c52740e5d6193091a70 100644 (file)
@@ -45,7 +45,7 @@ NetconfProcess::run() {
         // Let's process incoming data or expiring timers in a loop until
         // shutdown condition is detected.
         while (!shouldShutdown()) {
-            getIoService()->get_io_service().poll();
+            runIO();
         }
         stopIOService();
     } catch (const std::exception& ex) {
@@ -62,6 +62,15 @@ NetconfProcess::run() {
     LOG_DEBUG(netconf_logger, isc::log::DBGLVL_START_SHUT, NETCONF_RUN_EXIT);
 }
 
+size_t
+NetconfProcess::runIO() {
+    size_t cnt = getIoService()->get_io_service().poll();
+    if (!cnt) {
+        cnt = getIoService()->get_io_service().run_one();
+    }
+    return (cnt);
+}
+
 isc::data::ConstElementPtr
 NetconfProcess::shutdown(isc::data::ConstElementPtr /*args*/) {
     setShutdownFlag(true);
index ca02faf5d22c8e55ce1afc58bd3ab13d48f55710..26824b53905ea8a6d9aba7e47b41e2cc3856df14 100644 (file)
@@ -84,6 +84,14 @@ public:
 
     /// @brief Returns a pointer to the configuration manager.
     NetconfCfgMgrPtr getNetconfCfgMgr();
+
+private:
+
+    /// @brief Polls all ready handlers and then runs one handler if none
+    /// handlers have been executed as a result of polling.
+    ///
+    /// @return Number of executed handlers.
+    size_t runIO();
 };
 
 /// @brief Defines a shared pointer to NetconfProcess.