Show
Ignore:
Timestamp:
04/12/11 11:30:35 (2 years ago)
Author:
ahu
Message:

allow DNSSECKeeper to share a database connection on construction. Use this new feature to silence the 'every minute' new database connection!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/dnsseckeeper.hh

    r2128 r2153  
    3434using namespace ::boost::multi_index; 
    3535 
    36 class DNSSECKeeper 
     36class DNSSECKeeper : public boost::noncopyable 
    3737{ 
    3838public: 
     
    4848 
    4949private: 
    50   UeberBackend d_keymetadb; 
     50  UeberBackend* d_keymetadb; 
     51  bool d_ourDB; 
    5152 
    5253public: 
    53   DNSSECKeeper() : d_keymetadb("key-only") 
     54  DNSSECKeeper() : d_keymetadb( new UeberBackend("key-only")), d_ourDB(true) 
    5455  { 
     56     
     57  } 
     58   
     59  DNSSECKeeper(UeberBackend* db) : d_keymetadb(db), d_ourDB(false) 
     60  { 
     61  } 
     62   
     63  ~DNSSECKeeper() 
     64  { 
     65    if(d_ourDB) 
     66      delete d_keymetadb; 
    5567  } 
    5668  bool isSecuredZone(const std::string& zone); 
     
    8092  void startTransaction() 
    8193  { 
    82           (*d_keymetadb.backends.begin())->startTransaction("", -1); 
     94          (*d_keymetadb->backends.begin())->startTransaction("", -1); 
    8395  } 
    8496   
    8597  void commitTransaction() 
    8698  { 
    87           (*d_keymetadb.backends.begin())->commitTransaction(); 
     99          (*d_keymetadb->backends.begin())->commitTransaction(); 
    88100  } 
    89101