Changeset 230

Show
Ignore:
Timestamp:
02/04/04 23:41:17 (9 years ago)
Author:
ahu
Message:

timeout addition to qgen
added uitoa for negative serials in soa

Location:
trunk/pdns/pdns
Files:
4 modified

Legend:

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

    r198 r230  
    1717    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818*/ 
    19 // $Id: dnspacket.cc,v 1.23 2003/11/23 15:14:57 ahu Exp $ 
     19// $Id: dnspacket.cc,v 1.24 2004/02/04 22:41:17 ahu Exp $ 
    2020#include "utility.hh" 
    2121#include <cstdio> 
     
    12411241      // SPARC alignment issues. 
    12421242       
    1243       rr.content+=" ";rr.content+=itoa(getLong( datapos+offset    )); 
    1244       rr.content+=" ";rr.content+=itoa(getLong( datapos+offset+4  )); 
    1245       rr.content+=" ";rr.content+=itoa(getLong( datapos+offset+8  )); 
    1246       rr.content+=" ";rr.content+=itoa(getLong( datapos+offset+12 )); 
    1247       rr.content+=" ";rr.content+=itoa(getLong( datapos+offset+16 )); 
     1243      rr.content+=" ";rr.content+=uitoa(getLong( datapos+offset    )); 
     1244      rr.content+=" ";rr.content+=uitoa(getLong( datapos+offset+4  )); 
     1245      rr.content+=" ";rr.content+=uitoa(getLong( datapos+offset+8  )); 
     1246      rr.content+=" ";rr.content+=uitoa(getLong( datapos+offset+12 )); 
     1247      rr.content+=" ";rr.content+=uitoa(getLong( datapos+offset+16 )); 
    12481248 
    12491249      break; 
  • trunk/pdns/pdns/misc.cc

    r222 r230  
    256256} 
    257257 
     258string uitoa(unsigned int i) // MSVC 6 doesn't grok overloading (un)signed 
     259{ 
     260  ostringstream o; 
     261  o<<i; 
     262  return o.str(); 
     263} 
     264 
     265 
    258266string stringerror() 
    259267{ 
  • trunk/pdns/pdns/misc.hh

    r222 r230  
    117117string stringerror(); 
    118118string itoa(int i); 
     119string uitoa(unsigned int i); 
    119120 
    120121void dropPrivs(int uid, int gid); 
  • trunk/pdns/pdns/qgen.cc

    r229 r230  
    5656  unsigned int d_maxOutstanding; 
    5757  unsigned int d_maxToRead; 
     58  unsigned int d_timeout; 
    5859  unsigned int d_answeredOK; 
    5960  unsigned int d_delayed; 
     
    7879  void sendQuestion(const string& qname, QType qtype); 
    7980  QGen(const string &server, unsigned int port, const string &fileName, 
    80        unsigned int maxOutstanding, unsigned int maxBurst, unsigned int maxToRead); 
     81       unsigned int maxOutstanding, unsigned int maxBurst, unsigned int maxToRead, unsigned int timeout); 
    8182  void start(); 
    8283 
     
    9596           unsigned int maxOutstanding, 
    9697           unsigned int maxBurst, 
    97            unsigned int maxToRead) : d_in(fileName.c_str()) 
     98           unsigned int maxToRead, 
     99           unsigned int timeout) : d_in(fileName.c_str()) 
    98100{ 
    99101  d_answeredOK = d_numqueries = d_delayed = d_unmatched = d_servfail = d_nxdomain = 0; 
     
    105107  d_maxToRead = maxToRead; 
    106108  d_maxBurst=maxBurst; 
     109  d_timeout=timeout; 
    107110  struct in_addr inp; 
    108111  Utility::inet_aton(server.c_str(),&inp); 
     
    133136 
    134137  for(multiset<OutstandingQuestion>::iterator i=d_questions.begin();i!=d_questions.end();)  
    135     if(now-i->timeSent > 5) { 
    136       cout<<"No answer received to question for "<<i->qname<<endl; 
    137       cout<<i->qname<<" "<<i->qtype.getName()<<"NO ANSWER"<<endl; 
     138    if(now-i->timeSent > d_timeout) { 
     139      cerr<<"No answer received to question for "<<i->qname<<endl; 
     140      cout<<i->qname<<" "<<i->qtype.getName()<<" NO ANSWER"<<endl; 
    138141      d_unanswered.insert(*i); 
    139142      d_questions.erase(i++); 
     
    318321  at.add("max-outstanding",Numeric(),"200"); 
    319322  at.add("max-questions",Numeric(),"0"); 
     323  at.add("timeout",Numeric(),"30"); 
    320324  at.parse(argc, argv); 
    321325  cout<<"hier 1"<<endl; 
     
    329333  unsigned int maxOutstanding=at.getInt("max-outstanding"); 
    330334  unsigned int maxToRead=at.getInt("max-questions"); 
     335  unsigned int timeout=at.getInt("timeout"); 
    331336 
    332337  // parse commandline here 
    333338 
    334   QGen qg(server, port, fileName, maxOutstanding, maxBurst, maxToRead); 
     339  QGen qg(server, port, fileName, maxOutstanding, maxBurst, maxToRead, timeout); 
    335340  qg.start(); 
    336341