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<<Logger::Error<<"Error dealing with control socket request: "<<e.what()<<endl;
+ }
+ catch(AhuException& ae) {
+ L<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl;
+ }
}
void handleTCPClientReadable(int fd, boost::any& var)
strcpy(remoteaddr.sun_path, remote->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)));
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<DNSResourceRecord>&ret, int depth, int& res)
{
string prefix;
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!
// 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<uint32_t>::max();
for(tcache_t::value_type::second_type::iterator j=i->second.begin(); j != i->second.end(); ++j)
lowestTTL=min(lowestTTL, j->ttl);
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;