]> granicus.if.org Git - pdns/commitdiff
make sure we clean based on sequence index and not on hash index. This bug potentiall...
authorbert hubert <bert.hubert@powerdns.com>
Mon, 26 Sep 2016 10:12:59 +0000 (12:12 +0200)
committermind04 <mind04@monshouwer.org>
Mon, 26 Sep 2016 18:46:58 +0000 (20:46 +0200)
pdns/packetcache.cc
pdns/packetcache.hh

index 29de6481926f84fabe0ba725db421eea756a476d..498c92a53b8da13fe732ec06030f3d72eddd78cd 100644 (file)
@@ -416,10 +416,9 @@ void PacketCache::cleanup()
   unsigned int totErased=0;
   for(auto& mc : d_maps) {
     WriteLock wl(&mc.d_mut);
-    typedef cmap_t::nth_index<1>::type sequence_t;
-    sequence_t& sidx=mc.d_map.get<1>();
+    auto& sidx = boost::multi_index::get<SequenceTag>(mc.d_map);
     unsigned int erased=0, lookedAt=0;
-    for(sequence_t::iterator i=sidx.begin(); i != sidx.end(); lookedAt++) {
+    for(auto i=sidx.begin(); i != sidx.end(); lookedAt++) {
       if(i->ttd < now) {
        sidx.erase(i++);
        erased++;
index 22e455a48cde033fb668fa2b970086ed69c138ac..dd23524cb0e84d00755be2f399f1a22830971515 100644 (file)
@@ -113,6 +113,7 @@ private:
   void getTTLS();
 
   struct UnorderedNameTag{};
+  struct SequenceTag{};
   typedef multi_index_container<
     CacheEntry,
     indexed_by <
@@ -136,7 +137,7 @@ private:
                                                              member<CacheEntry,uint16_t,&CacheEntry::qtype>,
                                                              member<CacheEntry,uint16_t, &CacheEntry::ctype>,
                                                              member<CacheEntry,int, &CacheEntry::zoneID> > > ,
-      sequenced<>
+      sequenced<tag<SequenceTag>>
                            >
   > cmap_t;