]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Don't check for message TTL changes if the RRsets remain the same.
authorYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Fri, 5 Jul 2024 17:58:19 +0000 (19:58 +0200)
committerYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Fri, 5 Jul 2024 17:58:19 +0000 (19:58 +0200)
doc/Changelog
services/cache/dns.c

index c184ac22bbc64e9ffb46733fefe3c3436c8aafda..150817308afb9d848b6b5336cf396552fec5b11a 100644 (file)
@@ -1,3 +1,6 @@
+5 July 2024: Yorgos
+       - Don't check for message TTL changes if the RRsets remain the same.
+
 5 July 2024: Wouter
        - Fix for neater printout for error for missing DS response.
        - Fix neater printout.
index ff434ed4c6c1b912073f442923333c92c7154473..426c4506e584a6994ae081a4de40d5af024a633a 100644 (file)
@@ -113,17 +113,18 @@ store_rrsets(struct module_env* env, struct reply_info* rep, time_t now,
                        /* fallthrough */
                case 1: /* ref updated, item inserted */
                        rep->rrsets[i] = rep->ref[i].key;
-               }
-               /* if ref was updated make sure the message ttl is updated to
-                * the minimum of the current rrsets. */
-               lock_rw_rdlock(&rep->ref[i].key->entry.lock);
-               if(rep->ref[i].key->id != 0 &&
-                       rep->ref[i].id == rep->ref[i].key->id) {
+                       /* ref was updated; make sure the message ttl is
+                        * updated to the minimum of the current rrsets. */
+                       lock_rw_rdlock(&rep->ref[i].key->entry.lock);
                        /* if deleted, skip ttl update. */
-                       ttl = ((struct packed_rrset_data*)rep->rrsets[i]->entry.data)->ttl;
-                       if(ttl < min_ttl) min_ttl = ttl;
+                       if(rep->ref[i].key->id != 0 &&
+                               rep->ref[i].id == rep->ref[i].key->id) {
+                               ttl = ((struct packed_rrset_data*)
+                                   rep->rrsets[i]->entry.data)->ttl;
+                               if(ttl < min_ttl) min_ttl = ttl;
+                       }
+                       lock_rw_unlock(&rep->ref[i].key->entry.lock);
                }
-               lock_rw_unlock(&rep->ref[i].key->entry.lock);
        }
        if(min_ttl < rep->ttl) {
                rep->ttl = min_ttl;