mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[894-make-memfile-thread-safe] Updated after rebase
This commit is contained in:
committed by
Razvan Becheriu
parent
09ffc17d02
commit
07d50324e1
@@ -969,13 +969,6 @@ Memfile_LeaseMgr::getLeases4(SubnetID subnet_id) const {
|
||||
return (collection);
|
||||
}
|
||||
|
||||
void
|
||||
Memfile_LeaseMgr::getLeases4Internal(Lease4Collection& collection) const {
|
||||
for (auto lease = storage4_.begin(); lease != storage4_.end(); ++lease ) {
|
||||
collection.push_back(Lease4Ptr(new Lease4(**lease)));
|
||||
}
|
||||
}
|
||||
|
||||
Lease4Collection
|
||||
Memfile_LeaseMgr::getLeases4(const std::string& hostname) const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_HOSTNAME4)
|
||||
@@ -994,6 +987,29 @@ Memfile_LeaseMgr::getLeases4(const std::string& hostname) const {
|
||||
return (collection);
|
||||
}
|
||||
|
||||
Lease4Collection
|
||||
Memfile_LeaseMgr::getLeases4(const std::string& hostname) const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_HOSTNAME4)
|
||||
.arg(hostname);
|
||||
|
||||
Lease4Collection collection;
|
||||
if (MultiThreadingMgr::instance().getMode()) {
|
||||
std::lock_guard<std::mutex> lock(*mutex_);
|
||||
getLeases4Internal(hostname, collection);
|
||||
} else {
|
||||
getLeases4Internal(hostname, collection);
|
||||
}
|
||||
|
||||
return (collection);
|
||||
}
|
||||
|
||||
void
|
||||
Memfile_LeaseMgr::getLeases4Internal(Lease4Collection& collection) const {
|
||||
for (auto lease = storage4_.begin(); lease != storage4_.end(); ++lease ) {
|
||||
collection.push_back(Lease4Ptr(new Lease4(**lease)));
|
||||
}
|
||||
}
|
||||
|
||||
Lease4Collection
|
||||
Memfile_LeaseMgr::getLeases4() const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET4);
|
||||
@@ -1189,13 +1205,6 @@ Memfile_LeaseMgr::getLeases6(SubnetID subnet_id) const {
|
||||
return (collection);
|
||||
}
|
||||
|
||||
void
|
||||
Memfile_LeaseMgr::getLeases6Internal(Lease6Collection& collection) const {
|
||||
for (auto lease = storage6_.begin(); lease != storage6_.end(); ++lease ) {
|
||||
collection.push_back(Lease6Ptr(new Lease6(**lease)));
|
||||
}
|
||||
}
|
||||
|
||||
Lease6Collection
|
||||
Memfile_LeaseMgr::getLeases6(const std::string& hostname) const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_HOSTNAME6)
|
||||
@@ -1214,6 +1223,29 @@ Memfile_LeaseMgr::getLeases6(const std::string& hostname) const {
|
||||
return (collection);
|
||||
}
|
||||
|
||||
Lease6Collection
|
||||
Memfile_LeaseMgr::getLeases6(const std::string& hostname) const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_HOSTNAME6)
|
||||
.arg(hostname);
|
||||
|
||||
Lease6Collection collection;
|
||||
if (MultiThreadingMgr::instance().getMode()) {
|
||||
std::lock_guard<std::mutex> lock(*mutex_);
|
||||
getLeases6Internal(hostname, collection);
|
||||
} else {
|
||||
getLeases6Internal(hostname, collection);
|
||||
}
|
||||
|
||||
return (collection);
|
||||
}
|
||||
|
||||
void
|
||||
Memfile_LeaseMgr::getLeases6Internal(Lease6Collection& collection) const {
|
||||
for (auto lease = storage6_.begin(); lease != storage6_.end(); ++lease ) {
|
||||
collection.push_back(Lease6Ptr(new Lease6(**lease)));
|
||||
}
|
||||
}
|
||||
|
||||
Lease6Collection
|
||||
Memfile_LeaseMgr::getLeases6() const {
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET6);
|
||||
|
@@ -524,6 +524,13 @@ private:
|
||||
void getLeases4Internal(SubnetID subnet_id,
|
||||
Lease4Collection& collection) const;
|
||||
|
||||
/// @brief Returns all IPv4 leases for the particular hostname.
|
||||
///
|
||||
/// @param hostname hostname in lower case.
|
||||
/// @param collection lease collection
|
||||
void getLeases4Internal(const std::string& hostname,
|
||||
Lease4Collection& collection) const;
|
||||
|
||||
/// @brief Gets all IPv4 leases.
|
||||
///
|
||||
/// @param collection lease collection
|
||||
@@ -579,6 +586,13 @@ private:
|
||||
void getLeases6Internal(SubnetID subnet_id,
|
||||
Lease6Collection& collection) const;
|
||||
|
||||
/// @brief Returns all IPv6 leases for the particular hostname.
|
||||
///
|
||||
/// @param hostname hostname in lower case.
|
||||
/// @param collection lease collection
|
||||
void getLeases6Internal(const std::string& hostname,
|
||||
Lease6Collection& collection) const;
|
||||
|
||||
/// @brief Returns all IPv6 leases.
|
||||
///
|
||||
/// @param collection lease collection
|
||||
|
Reference in New Issue
Block a user