From: Peter van Dijk Date: Fri, 8 Jul 2016 07:49:04 +0000 (+0200) Subject: Merge pull request #4096 from rgacogne/rec-no-empty-commit X-Git-Tag: rec-4.0.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5584bfa86719b5ffb5671685d9838010f969125e;p=thirdparty%2Fpdns.git Merge pull request #4096 from rgacogne/rec-no-empty-commit rec: Don't call `commit()` if we skipped all the records --- 5584bfa86719b5ffb5671685d9838010f969125e diff --cc pdns/pdns_recursor.cc index 95950c7824,fd12a64d34..2f2f404829 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@@ -966,9 -1030,26 +967,10 @@@ 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(); - if(pbRR) { - pbRR->set_name(i->d_name.toString()); - pbRR->set_type(i->d_type); - pbRR->set_class_(i->d_class); - pbRR->set_ttl(i->d_ttl); - if (i->d_type == QType::A) { - const ARecordContent& arc = dynamic_cast(*(i->d_content)); - ComboAddress data = arc.getCA(); - pbRR->set_rdata(&data.sin4.sin_addr.s_addr, sizeof(data.sin4.sin_addr.s_addr)); - } - else if (i->d_type == QType::AAAA) { - const AAAARecordContent& arc = dynamic_cast(*(i->d_content)); - ComboAddress data = arc.getCA(); - pbRR->set_rdata(&data.sin6.sin6_addr.s6_addr, sizeof(data.sin6.sin6_addr.s6_addr)); - } - } + if(luaconfsLocal->protobufServer && (i->d_type == QType::A || i->d_type == QType::AAAA || i->d_type == QType::CNAME)) { + pbMessage.addRR(*i); } #endif }