Changeset 999

Show
Ignore:
Timestamp:
03/26/07 22:18:23 (2 years ago)
Author:
ahu
Message:

speedup for pdns_recursor, fix crashes of BIND backend, fix filedescriptor leak in BIND backend

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pdns/pdns/Makefile-recursor

    r752 r999  
    44CONFIGDIR="/etc/powerdns/" 
    55OPTFLAGS?=-O3 
    6 CXXFLAGS:= $(CXXFLAGS) -Wall $(OPTFLAGS) $(PROFILEFLAGS) 
     6CXXFLAGS:= $(CXXFLAGS) -Wall -DBOOST_SP_DISABLE_THREADS $(OPTFLAGS) $(PROFILEFLAGS) 
    77CFLAGS:=$(CFLAGS) -Wall $(OPTFLAGS) $(PROFILEFLAGS) 
    88LINKCC=$(CXX) 
  • trunk/pdns/pdns/backends/bind/bindbackend2.cc

    r987 r999  
    455455    return; 
    456456  } 
    457     
    458457  s_first=0; 
    459458  s_state = shared_ptr<State>(new State); 
     
    465464  dl->registerFunc("BIND-DOMAIN-STATUS", &DLDomStatusHandler); 
    466465  dl->registerFunc("BIND-LIST-REJECTS", &DLListRejectsHandler); 
     466} 
     467 
     468Bind2Backend::~Bind2Backend() 
     469{ 
     470  if(us==this) { 
     471    L<<Logger::Error<<"Main bind2backend instance being destructed"<<endl; 
     472    exit(1); 
     473  } 
    467474} 
    468475 
     
    630637    set_difference(newnames.begin(), newnames.end(), oldnames.begin(), oldnames.end(), back_inserter(diff2)); 
    631638    newdomains=diff2.size(); 
    632  
    633     s_state = staging; // and boy do we hope this is a threadsafe operation! 
     639     
     640    s_state.swap(staging); // and boy do we hope this is a threadsafe operation! 
    634641 
    635642    // report 
  • trunk/pdns/pdns/backends/bind/bindbackend2.hh

    r987 r999  
    2828using namespace std; 
    2929using namespace boost; 
    30  
    3130 
    3231/** This struct is used within the Bind2Backend to store DNS information.  
     
    9190public: 
    9291  Bind2Backend(const string &suffix=""); //!< Makes our connection to the database. Calls exit(1) if it fails. 
     92  ~Bind2Backend(); 
    9393  void getUnfreshSlaveInfos(vector<DomainInfo> *unfreshDomains); 
    9494  void getUpdatedMasters(vector<DomainInfo> *changedDomains); 
    9595  bool getDomainInfo(const string &domain, DomainInfo &di); 
    9696  time_t getCtime(const string &fname); 
    97    
    9897 
    9998  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
     
    115114  typedef map<uint32_t, BB2DomainInfo> id_zone_map_t; 
    116115 
    117   struct State  
     116  struct State : public boost::noncopyable 
    118117  { 
    119118    name_id_map_t name_id_map;  //!< convert a name to a domain id 
  • trunk/pdns/pdns/backends/bind/bindparser.hh

    r681 r999  
    3939 
    4040extern const char *bind_directory; 
     41extern FILE *yyin; 
    4142class BindParser 
    4243{ 
    4344 public: 
    44   BindParser() : d_dir("."), d_verbose(false)  
     45  BindParser() : d_dir("."), d_verbose(false) 
    4546  { 
     47    yyin=0; 
    4648    extern int include_stack_ptr; 
    4749    include_stack_ptr=0; 
    4850  
    4951    bind_directory=d_dir.c_str();  
     52  } 
     53  ~BindParser() 
     54  { 
     55    if(yyin) { 
     56      fclose(yyin); 
     57      yyin=0; 
     58    } 
    5059  } 
    5160  void parse(const string &fname);