]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1333] Removed useless getLease calls in createLeaseX
authorFrancis Dupont <fdupont@isc.org>
Wed, 22 Jul 2020 14:48:31 +0000 (16:48 +0200)
committerRazvan Becheriu <razvan@isc.org>
Fri, 28 Aug 2020 11:15:22 +0000 (14:15 +0300)
src/lib/dhcpsrv/alloc_engine.cc

index c63e9093a974ac3b2a2b846fa7fc48260479f963..2d55ef4b73a516649c95c9dbcac6b0b764ee3d4a 100644 (file)
@@ -1892,15 +1892,10 @@ Lease6Ptr AllocEngine::createLease6(ClientContext6& ctx,
     } else {
         // That is only fake (SOLICIT without rapid-commit) allocation
 
-        // It is for advertise only. We should not insert the lease into LeaseMgr,
-        // but rather check that we could have inserted it.
-        Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(
-                             ctx.currentIA().type_, addr);
-        if (!existing) {
-            return (lease);
-        } else {
-            return (Lease6Ptr());
-        }
+        // It is for advertise only. We should not insert the lease
+        // into LeaseMgr and callers have already verified the lease
+        // does not exist in the database.
+        return (lease);
     }
 }
 
@@ -3744,14 +3739,10 @@ AllocEngine::createLease4(const ClientContext4& ctx, const IOAddress& addr,
     } else {
         // That is only fake (DISCOVER) allocation
 
-        // It is for OFFER only. We should not insert the lease into LeaseMgr,
-        // but rather check that we could have inserted it.
-        Lease4Ptr existing = LeaseMgrFactory::instance().getLease4(addr);
-        if (!existing) {
-            return (lease);
-        } else {
-            return (Lease4Ptr());
-        }
+        // It is for OFFER only. We should not insert the lease into LeaseMgr
+        // and callers have already verified the lease does not exist
+        // in the database.
+        return (lease);
     }
 }