Changeset 1108
- Timestamp:
- 11/30/07 23:25:36 (2 years ago)
- Location:
- trunk/pdns/pdns/backends/bind
- Files:
-
- 2 modified
-
bindbackend2.cc (modified) (8 diffs)
-
bindbackend2.hh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/backends/bind/bindbackend2.cc
r1089 r1108 726 726 } 727 727 728 bool operator<(const Bind2DNSRecord &a, const string &b)729 {730 return a.qname < b;731 }732 733 bool operator<(const string &a, const Bind2DNSRecord &b)734 {735 return a < b.qname;736 }737 728 738 729 … … 743 734 string domain=toLower(qname); 744 735 745 bool mustlog=::arg().mustDo("query-logging");736 static bool mustlog=::arg().mustDo("query-logging"); 746 737 if(mustlog) 747 738 L<<Logger::Warning<<"Lookup for '"<<qtype.getName()<<"' of '"<<domain<<"'"<<endl; … … 749 740 shared_ptr<State> state = s_state; 750 741 751 while(!state->name_id_map.count(domain) && chopOff(domain)); 752 753 name_id_map_t::const_iterator iditer=state->name_id_map.find(domain); 742 name_id_map_t::const_iterator iditer; 743 while((iditer=state->name_id_map.find(domain)) == state->name_id_map.end() && chopOff(domain)) 744 ; 745 754 746 755 747 if(iditer==state->name_id_map.end()) { … … 761 753 // unsigned int id=*iditer; 762 754 if(mustlog) 763 L<<Logger::Warning<<"Found data in zone '"<<domain<<"' with id "<<iditer->second<<endl;755 L<<Logger::Warning<<"Found a zone '"<<domain<<"' (with id " << iditer->second<<") that might contain data "<<endl; 764 756 765 757 d_handle.id=iditer->second; … … 788 780 } 789 781 790 d_handle.d_records = state->id_zone_map[iditer->second].d_records; // give it a reference counted copy782 d_handle.d_records = bbd.d_records; // give it a reference counted copy 791 783 792 784 if(d_handle.d_records->empty()) … … 799 791 string lname=toLower(d_handle.qname); 800 792 range=equal_range(d_handle.d_records->begin(), d_handle.d_records->end(), lname); 793 d_handle.mustlog = mustlog; 801 794 802 795 if(range.first==range.second) { … … 807 800 d_handle.d_iter=range.first; 808 801 d_handle.d_end_iter=range.second; 809 d_handle.mustlog = mustlog;810 802 } 811 803 … … 820 812 bool Bind2Backend::get(DNSResourceRecord &r) 821 813 { 822 if(!d_handle.d_records) 814 if(!d_handle.d_records) { 815 if(d_handle.mustlog) 816 L<<Logger::Warning<<"There were no answers"<<endl; 823 817 return false; 818 } 824 819 825 820 if(!d_handle.get(r)) { 821 if(d_handle.mustlog) 822 L<<Logger::Warning<<"End of answers"<<endl; 823 826 824 d_handle.reset(); 827 828 if(::arg().mustDo("query-logging"))829 L<<"End of answers"<<endl;830 825 831 826 return false; -
trunk/pdns/pdns/backends/bind/bindbackend2.hh
r1039 r1108 54 54 return tie(qtype,content, ttl) < tie(rhs.qtype, rhs.content, rhs.ttl); 55 55 } 56 bool operator<(const string &b) const 57 { 58 return qname < b; 59 } 56 60 }; 61 62 inline bool operator<(const string &a, const Bind2DNSRecord &b) 63 { 64 return a < b.qname; 65 } 57 66 58 67