Permalink
Browse files

Correctly sort records with a priority. Closes #2843

  • Loading branch information...
1 parent edf46fe commit 2358eead5df5702fe42a9171f11f20bed77eb77f @pieterlexis pieterlexis committed Nov 2, 2015
Showing with 6 additions and 5 deletions.
  1. +6 −5 pdns/signingpipe.cc
View
@@ -109,11 +109,12 @@ ChunkedSigningPipe::~ChunkedSigningPipe()
namespace {
bool dedupLessThan(const DNSResourceRecord& a, const DNSResourceRecord &b)
{
- if(tie(a.content, a.ttl) < tie(b.content, b.ttl))
- return true;
- if(a.qtype.getCode() == QType::MX || a.qtype.getCode() == QType::SRV)
- return a.priority < b.priority;
- return false;
+ uint16_t aprio = 0, bprio = 0;
+ if (a.qtype.getCode() == QType::MX || a.qtype.getCode() == QType::SRV)
+ aprio = a.priority;
+ if (b.qtype.getCode() == QType::MX || b.qtype.getCode() == QType::SRV)
+ bprio = b.priority;
+ return tie(a.content, a.ttl, aprio) < tie(b.content, b.ttl, bprio);
}
bool dedupEqual(const DNSResourceRecord& a, const DNSResourceRecord &b)

0 comments on commit 2358eea

Please sign in to comment.