Permalink
Browse files

Make sure we send servfail on error

  • Loading branch information...
1 parent 27aa8de commit 3064f809fe1379a476b7ffce2c7da52588af2e18 @cmouse cmouse committed Sep 26, 2014
Showing with 17 additions and 5 deletions.
  1. +17 −5 pdns/distributor.hh
View
@@ -224,7 +224,7 @@ template<class Answer, class Question, class Backend>void *MultiThreadDistributo
us->d_overloaded=false;
}
- Answer *a;
+ Answer *a;
#ifndef SMTPREDIR
if(queuetimeout && q->d_dt.udiff()>queuetimeout*1000) {
@@ -241,12 +241,18 @@ template<class Answer, class Question, class Backend>void *MultiThreadDistributo
catch(const PDNSException &e) {
L<<Logger::Error<<"Backend error: "<<e.reason<<endl;
delete b;
- return 0;
+ a=q->replyPacket();
+ a->setRcode(RCode::ServFail);
+ S.inc("servfail-packets");
+ S.ringAccount("servfail-queries",q->qdomain);
}
catch(...) {
L<<Logger::Error<<Logger::NTLog<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<endl;
delete b;
- return 0;
+ a=q->replyPacket();
+ a->setRcode(RCode::ServFail);
+ S.inc("servfail-packets");
+ S.ringAccount("servfail-queries",q->qdomain);
}
AnswerData<Answer> AD;
@@ -276,13 +282,19 @@ template<class Answer, class Question, class Backend>int SingleThreadDistributor
L<<Logger::Error<<"Backend error: "<<e.reason<<endl;
delete b;
b=new Backend;
- return 0;
+ a=q->replyPacket();
+ a->setRcode(RCode::ServFail);
+ S.inc("servfail-packets");
+ S.ringAccount("servfail-queries",q->qdomain);
}
catch(...) {
L<<Logger::Error<<Logger::NTLog<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<endl;
delete b;
b=new Backend;
- return 0;
+ a=q->replyPacket();
+ a->setRcode(RCode::ServFail);
+ S.inc("servfail-packets");
+ S.ringAccount("servfail-queries",q->qdomain);
}
AnswerData<Answer> AD;
AD.A=a;

0 comments on commit 3064f80

Please sign in to comment.