From: Francis Dupont Date: Fri, 28 Sep 2018 10:45:20 +0000 (+0200) Subject: [128-netconf-use-libprocess] Adopted runIO() which of course will be extended X-Git-Tag: 128-netconf-config_base~5^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ad9f2d6b89ad26993fa3104dff60c2795dded709;p=thirdparty%2Fkea.git [128-netconf-use-libprocess] Adopted runIO() which of course will be extended --- diff --git a/src/bin/netconf/netconf_process.cc b/src/bin/netconf/netconf_process.cc index fc233640eb..b6e6e8feea 100644 --- a/src/bin/netconf/netconf_process.cc +++ b/src/bin/netconf/netconf_process.cc @@ -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); diff --git a/src/bin/netconf/netconf_process.h b/src/bin/netconf/netconf_process.h index ca02faf5d2..26824b5390 100644 --- a/src/bin/netconf/netconf_process.h +++ b/src/bin/netconf/netconf_process.h @@ -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.