]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1375] reset managers static IOService members
authorRazvan Becheriu <razvan@isc.org>
Fri, 6 Nov 2020 10:05:46 +0000 (12:05 +0200)
committerRazvan Becheriu <razvan@isc.org>
Wed, 9 Dec 2020 17:12:46 +0000 (19:12 +0200)
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/lib/dhcpsrv/host_mgr.h
src/lib/dhcpsrv/lease_mgr.h

index 6954e3308849fc3b33da052dfc3acfd6333c0044..830bc67b2ea3f7cc6d8aa85614c94da6af8aec03 100644 (file)
@@ -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.
index 920e5af9e4e0c057c1ebcb29f9279f4f2d3bbf3c..eade33157fd105c9c7ee9616420c7dd23d1ee736 100644 (file)
@@ -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.
index 8c1824470cbcc26c418326b41eb076fdd5ee2b89..adbb571cd5f80df599f2cfe60a23c40e69f82488 100644 (file)
@@ -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
index 89bd007ea56a2f842602ff1ff6b80b4955d810f3..434a703d51782cd81305d7cd3828c31275c31d3a 100644 (file)
@@ -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_;