Skip to content

Commit

Permalink
[#3149] Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fxdupont committed Jan 17, 2024
1 parent d84201c commit 5d23ed2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/lib/dhcpsrv/memfile_lease_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1695,18 +1695,17 @@ Memfile_LeaseMgr::getLeases6Internal(SubnetID subnet_id,
Lease6StorageSubnetIdIndex::const_iterator lb =
idx.lower_bound(boost::make_tuple(subnet_id, lower_bound_address));

// Exclude the lower bound address specified by the caller.
if ((lb != idx.end()) && ((*lb)->addr_ == lower_bound_address)) {
++lb;
}

// Return all leases being within the page size.
IOAddress last_addr = lower_bound_address;
for (auto it = lb; it != idx.end(); ++it) {
if ((*it)->addr_ == last_addr) {
// Already seen: skip it.
continue;
}
if ((*it)->subnet_id_ != subnet_id) {
// Gone after the subnet id index.
break;
}
last_addr = (*it)->addr_;
collection.push_back(Lease6Ptr(new Lease6(**it)));
if (collection.size() >= page_size.page_size_) {
break;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/dhcpsrv/memfile_lease_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class Memfile_LeaseMgr : public TrackingLeaseMgr {
getLeases6(const asiolink::IOAddress& lower_bound_address,
const LeasePageSize& page_size) const override;

/// @brief Returns a page of IPv6 leases for a subnet identifier.
/// @brief Returns a page of IPv6 leases for a subnet identifier.
///
/// @param subnet_id subnet identifier.
/// @param lower_bound_address IPv6 address used as lower bound for the
Expand Down Expand Up @@ -732,7 +732,7 @@ class Memfile_LeaseMgr : public TrackingLeaseMgr {
const LeasePageSize& page_size,
Lease6Collection& collection) const;

/// @brief Returns a page of IPv6 leases for a subnet identifier.
/// @brief Returns a page of IPv6 leases for a subnet identifier.
///
/// @param subnet_id subnet identifier.
/// @param lower_bound_address IPv6 address used as lower bound for the
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dhcpsrv/memfile_lease_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ typedef boost::multi_index_container<

// Specification of the fourth index starts here.
// This index sorts leases by SubnetID and address.
boost::multi_index::ordered_non_unique<
boost::multi_index::ordered_unique<
boost::multi_index::tag<SubnetIdIndexTag>,
boost::multi_index::composite_key<
Lease6,
Expand Down

0 comments on commit 5d23ed2

Please sign in to comment.