Commit d981c5ce authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[4309] Fixed Coverity issue 1341466e in alloc_engine.cc

src/lib/dhcpsrv/alloc_engine.cc
 - AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease,
                                 const DbReclaimMode& reclaim_mode,
                                 const CalloutHandlePtr& callout_handle)

   Simplified logic for flagging a lease for removal.  Renamed "remove_tmp"
   to "remove_lease" for clarity.

 - AllocEngine::reclaimExpiredLease(const Lease4Ptr& lease,
                                 const DbReclaimMode& reclaim_mode,
                                 const CalloutHandlePtr& callout_handle)

   Simplified logic for flagging a lease for removal.  Renamed "remove_tmp"
   to "remove_lease" for clarity.
parent b2e7801e
......@@ -1633,28 +1633,25 @@ AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease,
queueNCR(CHG_REMOVE, lease);
// Let's check if the lease that just expired is in DECLINED state.
// If it is, we need to conduct couple extra steps and also force
// its removal.
bool remove_tmp = (reclaim_mode == DB_RECLAIM_REMOVE);
// If it is, we need to conduct couple extra steps.
bool remove_lease = (reclaim_mode == DB_RECLAIM_REMOVE);
if (lease->state_ == Lease::STATE_DECLINED) {
// There's no point in keeping declined lease after its
// reclaimation. Declined lease doesn't have any client
// identifying information anymore.
if (reclaim_mode != DB_RECLAIM_LEAVE_UNCHANGED) {
remove_tmp = true;
}
// Do extra steps required for declined lease reclaimation:
// - call the recover hook
// - bump decline-related stats
// - log separate message
remove_tmp = reclaimDeclined(lease);
// There's no point in keeping declined lease after its
// reclaimation. Declined lease doesn't have any client
// identifying information anymore. So we'll flag it for
// removal unless the hook has set the skip flag.
remove_lease = reclaimDeclined(lease);
}
if (reclaim_mode != DB_RECLAIM_LEAVE_UNCHANGED) {
// Reclaim the lease - depending on the configuration, set the
// expired-reclaimed state or simply remove it.
LeaseMgr& lease_mgr = LeaseMgrFactory::instance();
reclaimLeaseInDatabase<Lease6Ptr>(lease, remove_tmp,
reclaimLeaseInDatabase<Lease6Ptr>(lease, remove_lease,
boost::bind(&LeaseMgr::updateLease6,
&lease_mgr, _1));
}
......@@ -1726,28 +1723,25 @@ AllocEngine::reclaimExpiredLease(const Lease4Ptr& lease,
queueNCR(CHG_REMOVE, lease);
// Let's check if the lease that just expired is in DECLINED state.
// If it is, we need to conduct couple extra steps and also force
// its removal.
bool remove_tmp = (reclaim_mode == DB_RECLAIM_REMOVE);
// If it is, we need to conduct couple extra steps.
bool remove_lease = (reclaim_mode == DB_RECLAIM_REMOVE);
if (lease->state_ == Lease::STATE_DECLINED) {
// There's no point in keeping declined lease after its
// reclaimation. Declined lease doesn't have any client
// identifying information anymore.
if (reclaim_mode != DB_RECLAIM_LEAVE_UNCHANGED) {
remove_tmp = true;
}
// Do extra steps required for declined lease reclaimation:
// - call the recover hook
// - bump decline-related stats
// - log separate message
remove_tmp = reclaimDeclined(lease);
// There's no point in keeping declined lease after its
// reclaimation. Declined lease doesn't have any client
// identifying information anymore. So we'll flag it for
// removal unless the hook has set the skip flag.
remove_lease = reclaimDeclined(lease);
}
if (reclaim_mode != DB_RECLAIM_LEAVE_UNCHANGED) {
// Reclaim the lease - depending on the configuration, set the
// expired-reclaimed state or simply remove it.
LeaseMgr& lease_mgr = LeaseMgrFactory::instance();
reclaimLeaseInDatabase<Lease4Ptr>(lease, remove_tmp,
reclaimLeaseInDatabase<Lease4Ptr>(lease, remove_lease,
boost::bind(&LeaseMgr::updateLease4,
&lease_mgr, _1));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment