From: Razvan Becheriu Date: Fri, 6 Nov 2020 10:05:46 +0000 (+0200) Subject: [#1375] reset managers static IOService members X-Git-Tag: Kea-1.9.3~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=039565157b2cfc024502dc0dc674ef01b64b8bfe;p=thirdparty%2Fkea.git [#1375] reset managers static IOService members --- diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 6954e33088..830bc67b2e 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -980,6 +980,12 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_P // CommandMgr uses IO service to run asynchronous socket operations. CommandMgr::instance().setIOService(getIOService()); + // LeaseMgr uses IO service to run asynchronous timers. + LeaseMgr::setIOService(getIOService()); + + // HosrMgr uses IO service to run asynchronous timers. + HostMgr::setIOService(getIOService()); + // These are the commands always supported by the DHCPv4 server. // Please keep the list in alphabetic order. CommandMgr::instance().registerCommand("build-report", @@ -1107,6 +1113,17 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() { CommandMgr::instance().deregisterCommand("status-get"); CommandMgr::instance().deregisterCommand("version-get"); + // TimerMgr uses IO service to run asynchronous timers. + TimerMgr::instance()->setIOService(IOServicePtr()); + + // CommandMgr uses IO service to run asynchronous socket operations. + CommandMgr::instance().setIOService(IOServicePtr()); + + // LeaseMgr uses IO service to run asynchronous timers. + LeaseMgr::setIOService(IOServicePtr()); + + // HosrMgr uses IO service to run asynchronous timers. + HostMgr::setIOService(IOServicePtr()); } catch (...) { // Don't want to throw exceptions from the destructor. The server // is shutting down anyway. diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 920e5af9e4..eade33157f 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -999,6 +999,12 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port, // CommandMgr uses IO service to run asynchronous socket operations. CommandMgr::instance().setIOService(getIOService()); + // LeaseMgr uses IO service to run asynchronous timers. + LeaseMgr::setIOService(getIOService()); + + // HosrMgr uses IO service to run asynchronous timers. + HostMgr::setIOService(getIOService()); + // These are the commands always supported by the DHCPv6 server. // Please keep the list in alphabetic order. CommandMgr::instance().registerCommand("build-report", @@ -1126,6 +1132,17 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { CommandMgr::instance().deregisterCommand("status-get"); CommandMgr::instance().deregisterCommand("version-get"); + // TimerMgr uses IO service to run asynchronous timers. + TimerMgr::instance()->setIOService(IOServicePtr()); + + // CommandMgr uses IO service to run asynchronous socket operations. + CommandMgr::instance().setIOService(IOServicePtr()); + + // LeaseMgr uses IO service to run asynchronous timers. + LeaseMgr::setIOService(IOServicePtr()); + + // HosrMgr uses IO service to run asynchronous timers. + HostMgr::setIOService(IOServicePtr()); } catch (...) { // Don't want to throw exceptions from the destructor. The server // is shutting down anyway. diff --git a/src/lib/dhcpsrv/host_mgr.h b/src/lib/dhcpsrv/host_mgr.h index 8c1824470c..adbb571cd5 100644 --- a/src/lib/dhcpsrv/host_mgr.h +++ b/src/lib/dhcpsrv/host_mgr.h @@ -659,6 +659,11 @@ protected: io_service_ = io_service; } + /// @brief Returns pointer to the IO service. + isc::asiolink::IOServicePtr& getIOService() { + return (io_service_); + } + private: /// @brief Indicates if backends are running in the mode in which IP diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h index 89bd007ea5..434a703d51 100644 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@ -768,6 +768,11 @@ public: io_service_ = io_service; } + /// @brief Returns pointer to the IO service. + isc::asiolink::IOServicePtr& getIOService() { + return (io_service_); + } + private: /// The IOService object, used for all ASIO operations. static isc::asiolink::IOServicePtr io_service_;