From: Kees Monshouwer Date: Wed, 29 Jun 2016 19:20:07 +0000 (+0200) Subject: abort on backend failures at startup and retry while running X-Git-Tag: rec-4.0.0~18^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07dbfb4f649ecfd76f152ce77fad560c9b7b04fb;p=thirdparty%2Fpdns.git abort on backend failures at startup and retry while running --- diff --git a/pdns/distributor.hh b/pdns/distributor.hh index 234fa86973..b506071ee5 100644 --- a/pdns/distributor.hh +++ b/pdns/distributor.hh @@ -126,7 +126,17 @@ templateDistributorSingleThreadDistributor::SingleThreadDistributor() { L<MultiThreadDistributor::MultiThreadDistributor(int n) @@ -188,13 +198,15 @@ templatevoid *MultiThreadDistributo } // this is the only point where we interact with the backend (synchronous) try { + if (!b) + b=new Backend(); a=b->question(QD->Q); delete QD->Q; } catch(const PDNSException &e) { L<Q->replyPacket(); a->setRcode(RCode::ServFail); @@ -206,7 +218,7 @@ templatevoid *MultiThreadDistributo catch(...) { L<Q->replyPacket(); a->setRcode(RCode::ServFail); @@ -223,9 +235,11 @@ templatevoid *MultiThreadDistributo } catch(const PDNSException &AE) { L<int SingleThreadDistributor { Answer *a; try { + if (!b) + b=new Backend; a=b->question(q); // a can be NULL! } catch(const PDNSException &e) { L<replyPacket(); a->setRcode(RCode::ServFail); S.inc("servfail-packets"); @@ -248,7 +264,7 @@ templateint SingleThreadDistributor catch(...) { L<replyPacket(); a->setRcode(RCode::ServFail); S.inc("servfail-packets"); diff --git a/pdns/dnsbackend.cc b/pdns/dnsbackend.cc index ac728e7605..aa527bf0a5 100644 --- a/pdns/dnsbackend.cc +++ b/pdns/dnsbackend.cc @@ -188,13 +188,13 @@ vectorBackendMakerClass::all(bool metadataOnly) L<::const_iterator i=ret.begin();i!=ret.end();++i) delete *i; - exit(1); + throw; } catch(...) { // and cleanup L<::const_iterator i=ret.begin();i!=ret.end();++i) delete *i; - exit(1); + throw; } return ret;