]> granicus.if.org Git - pdns/commitdiff
fix for BIND-backend issue about non-loaded zones, by Daniel Bilik
authorBert Hubert <bert.hubert@netherlabs.nl>
Wed, 21 Mar 2007 18:13:08 +0000 (18:13 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Wed, 21 Mar 2007 18:13:08 +0000 (18:13 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@984 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/backends/bind/bindbackend2.cc

index 8e5fe0b969fb162eaafd964da87fba50066defc7..9a7fc28c3db18e8cd9bdacb63cddf6f7085e9932 100644 (file)
@@ -746,25 +746,23 @@ void Bind2Backend::lookup(const QType &qtype, const string &qname, DNSPacket *pk
   d_handle.qtype=qtype;
   d_handle.domain=qname.substr(qname.size()-domain.length());
 
-
-  d_handle.d_records = state->id_zone_map[iditer->second].d_records; // give it a copy
-  if(!d_handle.d_records->empty()) {
-    BB2DomainInfo& bbd = state->id_zone_map[iditer->second];
-    if(!bbd.d_loaded) {
-      d_handle.reset();
-      throw DBException("Zone temporarily not available (file missing, or master dead)"); // fsck
-    }
-    
-    if(!bbd.current()) {
-      L<<Logger::Warning<<"Zone '"<<bbd.d_name<<"' ("<<bbd.d_filename<<") needs reloading"<<endl;
-      us->queueReload(&bbd);  // how can this be safe - ok, everybody should have their own reference counted copy of 'records'
-      d_handle.d_records = state->id_zone_map[iditer->second].d_records; // give it a *fresh* copy
-    }
+  BB2DomainInfo& bbd = state->id_zone_map[iditer->second];
+  if(!bbd.d_loaded) {
+    d_handle.reset();
+    throw DBException("Zone temporarily not available (file missing, or master dead)"); // fsck
   }
-  else {
-    DLOG(L<<"Query with no results"<<endl);
+    
+  if(!bbd.current()) {
+    L<<Logger::Warning<<"Zone '"<<bbd.d_name<<"' ("<<bbd.d_filename<<") needs reloading"<<endl;
+    us->queueReload(&bbd);  // how can this be safe - ok, everybody should have their own reference counted copy of 'records'
+    d_handle.d_records = state->id_zone_map[iditer->second].d_records; // give it a *fresh* copy
   }
 
+  d_handle.d_records = state->id_zone_map[iditer->second].d_records; // give it a copy
+  
+  if(d_handle.d_records->empty())
+    DLOG(L<<"Query with no results"<<endl);
+  
   pair<vector<Bind2DNSRecord>::const_iterator, vector<Bind2DNSRecord>::const_iterator> range;
 
   //  cout<<"starting equal range for: '"<<d_handle.qname<<"'"<<endl;