From: Bert Hubert Date: Tue, 30 Oct 2012 13:36:47 +0000 (+0000) Subject: move some functions around, plus when reloading a zone because it changed, hand out... X-Git-Tag: auth-3.2-rc1~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a3047110df07009ea9d572e2cd1098cb106d337c;p=thirdparty%2Fpdns.git move some functions around, plus when reloading a zone because it changed, hand out a single SERVFAIL, we'll have the answer for you next time 'realtime reloading' caused crashes. The resulting 'servfail' does appear to be cached slightly, so we need to work on that too. This makes it appear that a domain vanished for a little bit. git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2837 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/backends/bind/bindbackend2.cc b/pdns/backends/bind/bindbackend2.cc index ca538e7769..c9369ae35e 100644 --- a/pdns/backends/bind/bindbackend2.cc +++ b/pdns/backends/bind/bindbackend2.cc @@ -1,6 +1,6 @@ /* PowerDNS Versatile Database Driven Nameserver - Copyright (C) 2002 - 2011 PowerDNS.COM BV + Copyright (C) 2002 - 2012 PowerDNS.COM BV This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as @@ -464,12 +464,6 @@ void Bind2Backend::insert(shared_ptr stage, int id, const string &qnameu, records.insert(bdr); } -void Bind2Backend::reload() -{ - Lock l(&s_state_lock); - for(id_zone_map_t::iterator i = s_state->id_zone_map.begin(); i != s_state->id_zone_map.end(); ++i) - i->second.d_checknow=true; -} string Bind2Backend::DLReloadNowHandler(const vector&parts, Utility::pid_t ppid) { @@ -559,27 +553,19 @@ Bind2Backend::Bind2Backend(const string &suffix, bool loadZones) Bind2Backend::~Bind2Backend() { - } void Bind2Backend::rediscover(string *status) { loadConfig(status); } -#if 0 -static void prefetchFile(const std::string& fname) -{ - - static int fd; - if(fd > 0) - close(fd); - fd=open(fname.c_str(), O_RDONLY); - if(fd < 0) - return; - posix_fadvise(fd, 0, 0, POSIX_FADV_WILLNEED); +void Bind2Backend::reload() +{ + Lock l(&s_state_lock); + for(id_zone_map_t::iterator i = s_state->id_zone_map.begin(); i != s_state->id_zone_map.end(); ++i) + i->second.d_checknow=true; } -#endif void Bind2Backend::fixupAuth(shared_ptr records) { @@ -870,9 +856,10 @@ void Bind2Backend::queueReload(BB2DomainInfo *bbd) // we reload *now* for the time being try { - nukeZoneRecords(bbd); // ? do we need this? + // nukeZoneRecords(bbd); // ? do we need this? staging->id_zone_map[bbd->d_id]=s_state->id_zone_map[bbd->d_id]; - staging->id_zone_map[bbd->d_id].d_records=shared_ptr (new recordstorage_t); // nuke it + shared_ptr newrecords(new recordstorage_t); + staging->id_zone_map[bbd->d_id].d_records=newrecords; ZoneParserTNG zpt(bbd->d_filename, bbd->d_name, s_binddirectory); DNSResourceRecord rr; @@ -1085,7 +1072,7 @@ void Bind2Backend::lookup(const QType &qtype, const string &qname, DNSPacket *pk if(!bbd.current()) { L< d_records; //!< the actual records belonging to this domain private: time_t getCtime(); - time_t d_checkinterval; }; @@ -191,13 +187,8 @@ private: { public: bool get(DNSResourceRecord &); - void reset() - { - d_records.reset(); - qname.clear(); - mustlog=false; - } - + void reset(); + handle(); shared_ptr d_records;