Skip to content

Commit

Permalink
calidns: Don't crash if we don't have enough 'unknown' queries remaining
Browse files Browse the repository at this point in the history
  • Loading branch information
rgacogne committed Nov 15, 2016
1 parent 1704035 commit b4f5799
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pdns/calidns.cc
Expand Up @@ -246,8 +246,15 @@ try
cout<<"Aiming at "<<qps<< "qps for "<<seconds<<" seconds at cache hitrate "<<100.0*hitrate<<"%";
unsigned int misses=(1-hitrate)*qps*seconds;
unsigned int total=qps*seconds;
if (misses == 0) {
misses = 1;
}
cout<<", need "<<misses<<" misses, "<<total<<" queries, have "<<unknown.size()<<" unknown left!"<<endl;

if (misses > unknown.size()) {
cerr<<"Not enough queries remaining (need at least "<<misses<<" and got "<<unknown.size()<<", please add more to the query file), exiting."<<endl;
exit(1);
}
vector<vector<uint8_t>*> toSend;
unsigned int n;
for(n=0; n < misses; ++n) {
Expand Down

0 comments on commit b4f5799

Please sign in to comment.