AuthPacketCache::AuthPacketCache(size_t mapsCount): d_lastclean(time(nullptr))
{
d_maps.resize(mapsCount);
- for(auto& mc : d_maps) {
- pthread_rwlock_init(&mc.d_mut, 0);
- }
S.declare("packetcache-hit", "Number of hits on the packet cache");
S.declare("packetcache-miss", "Number of misses on the packet cache");
struct MapCombo
{
- pthread_rwlock_t d_mut;
+ MapCombo() {
+ pthread_rwlock_init(&d_mut, nullptr);
+ }
+ ~MapCombo() {
+ pthread_rwlock_destroy(&d_mut);
+ }
+ pthread_rwlock_t d_mut;
cmap_t d_map;
};
AuthQueryCache::AuthQueryCache(size_t mapsCount): d_lastclean(time(nullptr))
{
d_maps.resize(mapsCount);
- for(auto& mc : d_maps) {
- pthread_rwlock_init(&mc.d_mut, 0);
- }
S.declare("query-cache-hit","Number of hits on the query cache");
S.declare("query-cache-miss","Number of misses on the query cache");
struct MapCombo
{
- pthread_rwlock_t d_mut;
+ MapCombo() {
+ pthread_rwlock_init(&d_mut, nullptr);
+ }
+ ~MapCombo() {
+ pthread_rwlock_destroy(&d_mut);
+ }
+ pthread_rwlock_t d_mut;
cmap_t d_map;
};
}
#endif /* HAVE_CRYPTO_BOX_EASY_AFTERNM */
+
+DNSCryptContext::~DNSCryptContext() {
+ pthread_rwlock_destroy(&d_lock);
+}
+
DNSCryptContext::DNSCryptContext(const std::string& pName, const std::vector<CertKeyPaths>& certKeys): d_certKeyPaths(certKeys), providerName(pName)
{
pthread_rwlock_init(&d_lock, 0);
DNSCryptContext(const std::string& pName, const std::vector<CertKeyPaths>& certKeys);
DNSCryptContext(const std::string& pName, const DNSCryptCert& certificate, const DNSCryptPrivateKey& pKey);
-
+ ~DNSCryptContext();
+
void reloadCertificates();
void loadNewCertificate(const std::string& certFile, const std::string& keyFile, bool active=true, bool reload=false);
void addNewCertificate(const DNSCryptCert& newCert, const DNSCryptPrivateKey& newKey, bool active=true, bool reload=false);
public:
CacheShard(): d_entriesCount(0)
{
- pthread_rwlock_init(&d_lock, 0);
+ pthread_rwlock_init(&d_lock, nullptr);
}
CacheShard(const CacheShard& old): d_entriesCount(0)
{
- pthread_rwlock_init(&d_lock, 0);
+ pthread_rwlock_init(&d_lock, nullptr);
+ }
+ ~CacheShard() {
+ pthread_rwlock_destroy(&d_lock);
}
-
void setSize(size_t maxSize)
{
d_map.reserve(maxSize);
{
pthread_rwlock_init(&queryLock, nullptr);
}
+ ~QueryCount()
+ {
+ pthread_rwlock_destroy(&queryLock);
+ }
QueryCountRecords records;
QueryCountFilter filter;
pthread_rwlock_t queryLock;
fd = -1;
}
}
+ pthread_rwlock_destroy(&d_lock);
}
boost::uuids::uuid id;
std::set<unsigned int> hashes;
{
pthread_rwlock_init(&d_lock, nullptr);
}
+ ~ServerPool()
+ {
+ pthread_rwlock_destroy(&d_lock);
+ }
const std::shared_ptr<DNSDistPacketCache> getCache() const { return packetCache; };
refreshDBIfNeeded(now);
}
+CDBKVStore::~CDBKVStore() {
+ pthread_rwlock_destroy(&d_lock);
+}
+
bool CDBKVStore::reload(const struct stat& st)
{
auto newCDB = std::unique_ptr<CDB>(new CDB(d_fname));
{
public:
CDBKVStore(const std::string& fname, time_t refreshDelay);
+ ~CDBKVStore();
bool keyExists(const std::string& key) override;
bool getValue(const std::string& key, std::string& value) override;
pthread_rwlock_init(&d_lock4, 0);
pthread_rwlock_init(&d_lock6, 0);
}
+ ~TimedIPSetRule()
+ {
+ pthread_rwlock_destroy(&d_lock4);
+ pthread_rwlock_destroy(&d_lock6);
+ }
bool matches(const DNSQuestion* dq) const override
{
if(dq->remote->sin4.sin_family == AF_INET) {
TryReadLock trl2(&*g_locks[0]);
BOOST_CHECK(trl2.gotIt());
-
+ for(auto& pp : g_locks) {
+ pthread_rwlock_destroy(pp.get());
+ }
}
BOOST_AUTO_TEST_SUITE_END()