From ab5c053d89175bd335702d99cf88bea8c44b67a0 Mon Sep 17 00:00:00 2001 From: Bert Hubert Date: Sat, 6 May 2006 12:21:46 +0000 Subject: [PATCH] implement improved control channel error logging implement 2 week max ttl git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@820 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- pdns/pdns_recursor.cc | 12 ++++++++++-- pdns/rec_channel.cc | 2 +- pdns/syncres.cc | 7 ++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index d68b45325..e715a7ef5 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -987,8 +987,16 @@ void handleRCC(int fd, boost::any& var) RecursorControlParser rcp; RecursorControlParser::func_t* command; string answer=rcp.getAnswer(msg, &command); - s_rcc.send(answer, &remote); - command(); + try { + s_rcc.send(answer, &remote); + command(); + } + catch(exception& e) { + L<c_str()); if(::sendto(d_fd, msg.c_str(), msg.length(), 0, (struct sockaddr*) &remoteaddr, sizeof(remoteaddr) ) < 0) - throw AhuException("Unable to send message over control channel: "+string(strerror(errno))); + throw AhuException("Unable to send message over control channel '"+*remote+"': "+string(strerror(errno))); } else if(::send(d_fd, msg.c_str(), msg.length(), 0) < 0) throw AhuException("Unable to send message over control channel: "+string(strerror(errno))); diff --git a/pdns/syncres.cc b/pdns/syncres.cc index a207f1630..5df6f31d5 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -103,6 +103,7 @@ int SyncRes::beginResolve(const string &qname, const QType &qtype, uint16_t qcla return res; } +//! This is the 'out of band resolver', in other words, the authoritative server bool SyncRes::doOOBResolve(const string &qname, const QType &qtype, vector&ret, int depth, int& res) { string prefix; @@ -701,7 +702,7 @@ int SyncRes::doResolveAt(set nameservers, string auth, rr.d_place=DNSResourceRecord::ANSWER; // if(rr.ttl < 5) // rr.ttl=60; - + rr.ttl=min(86400*14U, rr.ttl); // limit TTL to two weeks rr.ttl += d_now.tv_sec; if(rr.qtype.getCode() == QType::NS) // people fiddle with the case rr.content=toLower(rr.content); // this must stay! @@ -714,7 +715,7 @@ int SyncRes::doResolveAt(set nameservers, string auth, // supplant for(tcache_t::const_iterator i=tcache.begin();i!=tcache.end();++i) { - if(i->second.size() > 1) { + if(i->second.size() > 1) { // need to group the ttl to be the minimum of the RRSET (RFC 2181, 5.2) uint32_t lowestTTL=numeric_limits::max(); for(tcache_t::value_type::second_type::iterator j=i->second.begin(); j != i->second.end(); ++j) lowestTTL=min(lowestTTL, j->ttl); @@ -742,7 +743,7 @@ int SyncRes::doResolveAt(set nameservers, string auth, ne.d_qname=i->qname; ne.d_ttd=d_now.tv_sec + min(i->ttl, s_maxnegttl); // controversial ne.d_name=qname; - ne.d_qtype=QType(0); + ne.d_qtype=QType(0); // this encodes 'whole record' replacing_insert(s_negcache, ne); negindic=true; -- 2.49.0