]> granicus.if.org Git - pdns/commitdiff
Merge pull request #4096 from rgacogne/rec-no-empty-commit
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 8 Jul 2016 07:49:04 +0000 (09:49 +0200)
committerGitHub <noreply@github.com>
Fri, 8 Jul 2016 07:49:04 +0000 (09:49 +0200)
rec: Don't call `commit()` if we skipped all the records

1  2 
pdns/pdns_recursor.cc

index 95950c782450286371fddb663f7f071bff7af49b,fd12a64d34fd92ff43ff5344fae61fc742b1f649..2f2f4048292b492a526965392ee913f3d4f7551d
@@@ -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<const ARecordContent&>(*(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<const AAAARecordContent&>(*(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
        }