Changeset 618

Show
Ignore:
Timestamp:
03/25/06 18:09:02 (4 years ago)
Author:
ahu
Message:

remote a lot of silly string processing used for --trace output, even w/o a trace..

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/syncres.cc

    r617 r618  
    6565int SyncRes::doResolve(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret, int depth, set<GetBestNSAnswer>& beenthere) 
    6666{ 
    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  } 
    6973   
    7074  int res; 
     
    120124void SyncRes::getBestNSFromCache(const string &qname, set<DNSResourceRecord>&bestns, int depth, set<GetBestNSAnswer>& beenthere) 
    121125{ 
    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  } 
    124131  bestns.clear(); 
    125132 
     
    188195bool SyncRes::doCNAMECacheCheck(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret, int depth, int &res) 
    189196{ 
    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  } 
    192202 
    193203  if(depth>10) { 
     
    197207  } 
    198208   
    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; 
    200210  set<DNSResourceRecord> cset; 
    201211  if(RC.get(d_now.tv_sec, qname,QType(QType::CNAME),&cset) > 0) { 
     
    203213    for(set<DNSResourceRecord>::const_iterator j=cset.begin();j!=cset.end();++j) { 
    204214      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;     
    206216        DNSResourceRecord rr=*j; 
    207217        rr.ttl-=d_now.tv_sec; 
     
    217227    } 
    218228  } 
    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; 
    220230  return false; 
    221231} 
     
    224234{ 
    225235  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  } 
    228242 
    229243  string sqname(qname); 
     
    339353  } 
    340354  random_shuffle(rnameservers.begin(),rnameservers.end()); 
    341   stable_sort(rnameservers.begin(),rnameservers.end(),speedOrder(speeds)); 
     355  stable_sort(rnameservers.begin(),rnameservers.end(), speedOrder(speeds)); 
    342356   
    343357  if(s_log) { 
     
    360374                int depth, set<GetBestNSAnswer>&beenthere) 
    361375{ 
    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  } 
    364381   
    365382  LWRes::res_t result; 
     
    370387    result.clear(); 
    371388 
    372     vector<string> rnameservers=shuffle(nameservers, prefix+qname+": "); 
     389    vector<string> rnameservers=shuffle(nameservers, s_log ? (prefix+qname+": ") : string() ); 
    373390 
    374391    for(vector<string>::const_iterator tns=rnameservers.begin();;++tns) {