]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
python mod invalidate routine fix.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 6 Apr 2009 12:35:02 +0000 (12:35 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 6 Apr 2009 12:35:02 +0000 (12:35 +0000)
git-svn-id: file:///svn/unbound/trunk@1589 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
pythonmod/pythonmod_utils.c

index 89117520966f147c9bb9a236e6638bb0585294a3..7a11065a45aece3f5241df43275778051e164dc9 100644 (file)
@@ -10,6 +10,7 @@
          /usr/lib/python2.x/site-packages/_unbound.so*
          The example python scripts (pythonmod/examples and
          libunbound/python/examples) are not installed.
+       - python invalidate routine respects packed rrset ids and locks.
 
 3 April 2009: Wouter
        - Fixed a bug that caused messages to be stored in the cache too 
index 241bbc5bbbcccd8fd7903d1208433192d4beff86..93cbb6d5800003242c0b4ca282f2d8173b40a59b 100644 (file)
@@ -42,6 +42,7 @@
 #include "util/module.h"
 #include "util/net_help.h"
 #include "services/cache/dns.h"
+#include "services/cache/rrset.h"
 #include "util/data/msgparse.h"
 #include "util/data/msgreply.h"
 #include "util/storage/slabhash.h"
@@ -78,16 +79,20 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin
         if (r) 
         {
            r->ttl = 0;
-           for(i=0; i< r->rrset_count; i++) 
-           {
-               struct packed_rrset_data* data = (struct packed_rrset_data*) r->ref[i].key->entry.data;
-               if(i>0 && r->ref[i].key == r->ref[i-1].key)
-                   continue;
-      
-               data->ttl = r->ttl;
-               for(j=0; j<data->count + data->rrsig_count; j++)
-                   data->rr_ttl[j] = r->ttl;
-           }
+          if(rrset_array_lock(r->ref, r->rrset_count, *qstate->env->now)) {
+                  for(i=0; i< r->rrset_count; i++) 
+                  {
+                      struct packed_rrset_data* data = 
+                       (struct packed_rrset_data*) r->ref[i].key->entry.data;
+                      if(i>0 && r->ref[i].key == r->ref[i-1].key)
+                          continue;
+             
+                      data->ttl = r->ttl;
+                      for(j=0; j<data->count + data->rrsig_count; j++)
+                          data->rr_ttl[j] = r->ttl;
+                  }
+                  rrset_array_unlock(r->ref, r->rrset_count);
+          }
         }
         lock_rw_unlock(&e->lock);
     } else {