From 0afa32d4d40ab54aa282b7c86f38aa52729784d0 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 4 Jul 2016 11:45:18 +0200 Subject: [PATCH] rec: Don't call `commit()` if we skipped all the records --- pdns/pdns_recursor.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 33c9364a85..fd12a64d34 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1012,7 +1012,8 @@ void startDoResolve(void *p) if(haveEDNS) { ret.push_back(makeOpt(edo.d_packetsize, 0, edo.d_Z)); } - + + bool needCommit = false; for(auto i=ret.cbegin(); i!=ret.cend(); ++i) { if(!DNSSECOK && (i->d_type == QType::RRSIG || i->d_type==QType::NSEC || i->d_type==QType::NSEC3)) continue; @@ -1029,6 +1030,7 @@ void startDoResolve(void *p) } goto sendit; // need to jump over pw.commit } + needCommit = true; #ifdef HAVE_PROTOBUF if(luaconfsLocal->protobufServer && protobufResponse && (i->d_type == QType::A || i->d_type == QType::AAAA)) { PBDNSMessage_DNSResponse_DNSRR* pbRR = protobufResponse->add_rrs(); @@ -1051,7 +1053,7 @@ void startDoResolve(void *p) } #endif } - if(ret.size()) + if(needCommit) pw.commit(); } sendit:; -- 2.47.2