]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Compare the CacheKey type and place first then the name 7939/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 11 Jun 2019 12:47:53 +0000 (14:47 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 17 Jun 2019 08:03:30 +0000 (10:03 +0200)
We don't care about the actual ordering, so let's do the cheapest
comparisons first then the quite expensive DNSName comparison only
if we really need to.

(cherry picked from commit 186e99c98d195329af05129cd4d6512657edf4bc)

pdns/syncres.cc

index 8e8f747b1cba6cf7a607ea77c70cb7841653c02e..148ee84b8675a7ed40043cda2c9c704a00a26128 100644 (file)
@@ -1111,7 +1111,7 @@ struct CacheKey
   uint16_t type;
   DNSResourceRecord::Place place;
   bool operator<(const CacheKey& rhs) const {
-    return tie(name, type, place) < tie(rhs.name, rhs.type, rhs.place);
+    return tie(type, place, name) < tie(rhs.type, rhs.place, rhs.name);
   }
 };
 typedef map<CacheKey, CacheEntry> tcache_t;