mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 00:40:00 -04:00
Remove useless .expire initialization from rdataslab
dns_rdataslab_fromrdataset() set .expire to rdataset->ttl, but the only consumer (qpcache_addrdataset) immediately overwrote it with now + rdataset->ttl. Remove the redundant initialization and set the expire time only once.
This commit is contained in:
parent
e3b60291aa
commit
08a33a9cc9
3 changed files with 4 additions and 9 deletions
|
|
@ -191,10 +191,8 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
|||
*
|
||||
* dns_rdataslab_fromrdataset() allocates space for a dns_slabheader object
|
||||
* and the memory needed for a raw slab, and partially initializes
|
||||
* it, setting the type, trust, and TTL fields to match rdataset->type,
|
||||
* rdataset->covers, rdataset->trust, and rdataset->ttl. (Note that the
|
||||
* last field needs to be overridden when used in the cache database,
|
||||
* since cache headers use an expire time instead of a TTL.)
|
||||
* it, setting the type, and trust fields to match rdataset->type,
|
||||
* rdataset->covers, and rdataset->trust.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'rdataset' is valid.
|
||||
|
|
|
|||
|
|
@ -2874,11 +2874,9 @@ qpcache_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||
dns_slabheader_reset(newheader, node);
|
||||
|
||||
/*
|
||||
* By default, dns_rdataslab_fromrdataset() sets newheader->ttl
|
||||
* to the rdataset TTL. In the case of the cache, that's wrong;
|
||||
* we need it to be set to the expire time instead.
|
||||
* Set the correct expire time.
|
||||
*/
|
||||
setttl(newheader, rdataset->ttl + now);
|
||||
setttl(newheader, now + rdataset->ttl);
|
||||
if (rdataset->ttl == 0U) {
|
||||
DNS_SLABHEADER_SETATTR(newheader, DNS_SLABHEADERATTR_ZEROTTL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ newslab(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region,
|
|||
*header = (dns_slabheader_t){
|
||||
.headers_link = CDS_LIST_HEAD_INIT(header->headers_link),
|
||||
.trust = rdataset->trust,
|
||||
.expire = rdataset->ttl,
|
||||
.dirtylink = ISC_LINK_INITIALIZER,
|
||||
.nitems = nitems,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue