Changeset 618
- Timestamp:
- 03/25/06 18:09:02 (4 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/syncres.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/syncres.cc
r617 r618 65 65 int SyncRes::doResolve(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret, int depth, set<GetBestNSAnswer>& beenthere) 66 66 { 67 string prefix(d_prefix); 68 prefix.append(depth, ' '); 67 68 string prefix; 69 if(s_log) { 70 prefix=d_prefix; 71 prefix.append(depth, ' '); 72 } 69 73 70 74 int res; … … 120 124 void SyncRes::getBestNSFromCache(const string &qname, set<DNSResourceRecord>&bestns, int depth, set<GetBestNSAnswer>& beenthere) 121 125 { 122 string prefix(d_prefix), subdomain(qname); 123 prefix.append(depth, ' '); 126 string prefix, subdomain(qname); 127 if(s_log) { 128 prefix=d_prefix; 129 prefix.append(depth, ' '); 130 } 124 131 bestns.clear(); 125 132 … … 188 195 bool SyncRes::doCNAMECacheCheck(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret, int depth, int &res) 189 196 { 190 string prefix(d_prefix), tuple=toLowerCanonic(qname)+"|CNAME"; 191 prefix.append(depth, ' '); 197 string prefix; 198 if(s_log) { 199 prefix=d_prefix; 200 prefix.append(depth, ' '); 201 } 192 202 193 203 if(depth>10) { … … 197 207 } 198 208 199 LOG<<prefix<<qname<<": Looking for CNAME cache hit of '"<< tuple<<"'"<<endl;209 LOG<<prefix<<qname<<": Looking for CNAME cache hit of '"<<(toLowerCanonic(qname)+"|CNAME")<<"'"<<endl; 200 210 set<DNSResourceRecord> cset; 201 211 if(RC.get(d_now.tv_sec, qname,QType(QType::CNAME),&cset) > 0) { … … 203 213 for(set<DNSResourceRecord>::const_iterator j=cset.begin();j!=cset.end();++j) { 204 214 if(j->ttl>(unsigned int) d_now.tv_sec) { 205 LOG<<prefix<<qname<<": Found cache CNAME hit for '"<< tuple<<"' to '"<<j->content<<"'"<<endl;215 LOG<<prefix<<qname<<": Found cache CNAME hit for '"<< (toLowerCanonic(qname)+"|CNAME") <<"' to '"<<j->content<<"'"<<endl; 206 216 DNSResourceRecord rr=*j; 207 217 rr.ttl-=d_now.tv_sec; … … 217 227 } 218 228 } 219 LOG<<prefix<<qname<<": No CNAME cache hit of '"<< tuple<<"' found"<<endl;229 LOG<<prefix<<qname<<": No CNAME cache hit of '"<< (toLowerCanonic(qname)+"|CNAME") <<"' found"<<endl; 220 230 return false; 221 231 } … … 224 234 { 225 235 bool giveNegative=false; 226 string prefix(d_prefix), tuple; 227 prefix.append(depth, ' '); 236 237 string prefix, tuple; 238 if(s_log) { 239 prefix=d_prefix; 240 prefix.append(depth, ' '); 241 } 228 242 229 243 string sqname(qname); … … 339 353 } 340 354 random_shuffle(rnameservers.begin(),rnameservers.end()); 341 stable_sort(rnameservers.begin(),rnameservers.end(), speedOrder(speeds));355 stable_sort(rnameservers.begin(),rnameservers.end(), speedOrder(speeds)); 342 356 343 357 if(s_log) { … … 360 374 int depth, set<GetBestNSAnswer>&beenthere) 361 375 { 362 string prefix(d_prefix); 363 prefix.append(depth, ' '); 376 string prefix; 377 if(s_log) { 378 prefix=d_prefix; 379 prefix.append(depth, ' '); 380 } 364 381 365 382 LWRes::res_t result; … … 370 387 result.clear(); 371 388 372 vector<string> rnameservers=shuffle(nameservers, prefix+qname+": ");389 vector<string> rnameservers=shuffle(nameservers, s_log ? (prefix+qname+": ") : string() ); 373 390 374 391 for(vector<string>::const_iterator tns=rnameservers.begin();;++tns) {