From 044dcd697d81aa55f43d0a2743c32e07b51009ad Mon Sep 17 00:00:00 2001 From: Bert Hubert Date: Thu, 29 Jan 2004 20:39:19 +0000 Subject: [PATCH] make output easier to parse git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@227 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- pdns/qgen.cc | 54 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/pdns/qgen.cc b/pdns/qgen.cc index 74b735c67..5fd1ec0e1 100644 --- a/pdns/qgen.cc +++ b/pdns/qgen.cc @@ -57,6 +57,9 @@ class QGen unsigned int d_answeredOK; unsigned int d_delayed; unsigned int d_unmatched; + unsigned int d_maxBurst; + unsigned int d_servfail; + unsigned int d_nxdomain; time_t d_laststats; int d_clientsock; string d_server; @@ -66,13 +69,14 @@ class QGen int fillAndSendQuestions(); void processAnswers(); void pruneUnanswered(); - void sendQuestion(const string& qname, QType qtype); + static bool tooOld(const OutstandingQuestion &oq); void printStats(bool force=false); public: + void sendQuestion(const string& qname, QType qtype); QGen(const string &server, unsigned int port, const string &fileName, - unsigned int maxOutstanding, unsigned int maxToRead); + unsigned int maxOutstanding, unsigned int maxBurst, unsigned int maxToRead); void start(); }; @@ -88,16 +92,17 @@ QGen::QGen(const string &server, unsigned int port, const string &fileName, unsigned int maxOutstanding, + unsigned int maxBurst, unsigned int maxToRead) : d_in(fileName.c_str()) { - d_answeredOK = d_numqueries = d_delayed = d_unmatched =0; + d_answeredOK = d_numqueries = d_delayed = d_unmatched = d_servfail = d_nxdomain = 0; if(!d_in) unixDie("unable to open '"+fileName+"'"); d_maxOutstanding = maxOutstanding; d_maxToRead = maxToRead; - + d_maxBurst=maxBurst; struct in_addr inp; Utility::inet_aton(server.c_str(),&inp); d_toaddr.sin_addr.s_addr=inp.s_addr; @@ -128,6 +133,7 @@ void QGen::pruneUnanswered() for(multiset::iterator i=d_questions.begin();i!=d_questions.end();) if(now-i->timeSent > 5) { cout<<"No answer received to question for "<qname<qname<<"\tNO ANSWER"<::const_iterator j=answers.begin();j!=answers.end();++j) - cout<content<d_place==DNSResourceRecord::ANSWER) + cout<content<