2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#3449] clean up on destructor

This commit is contained in:
Razvan Becheriu
2024-06-26 16:59:27 +03:00
parent 0fe6f2e381
commit 6419c57b9d
7 changed files with 16 additions and 26 deletions

View File

@@ -209,16 +209,7 @@ public:
fake_received_.push_back(pkt);
}
virtual ~NakedDhcpv4Srv() {
// Close the lease database
isc::dhcp::LeaseMgrFactory::destroy();
getIOService()->restart();
try {
getIOService()->poll();
} catch (...) {
}
}
virtual ~NakedDhcpv4Srv() = default;
/// @brief Runs processing DHCPDISCOVER.
///

View File

@@ -216,11 +216,7 @@ public:
fake_received_.push_back(pkt);
}
virtual ~NakedDhcpv6Srv() {
// Close the lease database
isc::dhcp::LeaseMgrFactory::destroy();
getIOService()->stopAndPoll();
}
virtual ~NakedDhcpv6Srv() = default;
/// @brief Processes incoming Solicit message.
///

View File

@@ -429,11 +429,8 @@ int load(LibraryHandle& handle) {
/// @return 0 if deregistration was successful, 1 otherwise
int unload() {
if (impl) {
IOServicePtr io_service = impl->getIOService();
IOServiceMgr::instance().unregisterIOService(io_service);
io_service->stopAndPoll();
IOServiceMgr::instance().unregisterIOService(impl->getIOService());
impl.reset();
io_service->stopAndPoll();
}
LOG_INFO(ha_logger, HA_DEINIT_OK);
return (0);

View File

@@ -66,6 +66,9 @@ HAImpl::~HAImpl() {
// than relying on destruction order.
service->stopClientAndListener();
}
config_.reset();
services_.reset(new HAServiceMapper());
io_service_->stopAndPoll();
}
void

View File

@@ -245,7 +245,6 @@ protected:
/// @brief Pointer to the high availability services (state machines).
HAServiceMapperPtr services_;
};
/// @brief Pointer to the High Availability hooks library implementation.

View File

@@ -94,9 +94,11 @@ int unload() {
// Unregister the factories and remove MySQL backends
isc::dhcp::MySqlConfigBackendDHCPv4::unregisterBackendType();
isc::dhcp::MySqlConfigBackendDHCPv6::unregisterBackendType();
IOServiceMgr::instance().unregisterIOService(isc::dhcp::MySqlConfigBackendImpl::getIOService());
if (isc::dhcp::MySqlConfigBackendImpl::getIOService()) {
isc::dhcp::MySqlConfigBackendImpl::getIOService()->stopAndPoll();
IOServicePtr io_service = isc::dhcp::MySqlConfigBackendImpl::getIOService();
if (io_service) {
IOServiceMgr::instance().unregisterIOService(io_service);
io_service->stopAndPoll();
isc::dhcp::MySqlConfigBackendImpl::setIOService(IOServicePtr());
}
return (0);
}

View File

@@ -94,9 +94,11 @@ int unload() {
// Unregister the factories and remove PostgreSQL backends
isc::dhcp::PgSqlConfigBackendDHCPv4::unregisterBackendType();
isc::dhcp::PgSqlConfigBackendDHCPv6::unregisterBackendType();
IOServiceMgr::instance().unregisterIOService(isc::dhcp::PgSqlConfigBackendImpl::getIOService());
if (isc::dhcp::PgSqlConfigBackendImpl::getIOService()) {
isc::dhcp::PgSqlConfigBackendImpl::getIOService()->stopAndPoll();
IOServicePtr io_service = isc::dhcp::PgSqlConfigBackendImpl::getIOService();
if (io_service) {
IOServiceMgr::instance().unregisterIOService(io_service);
io_service->stopAndPoll();
isc::dhcp::PgSqlConfigBackendImpl::setIOService(IOServicePtr());
}
return (0);
}