while (ni != content->d_map.end() && ni->d_name == lastLabel && ni->d_auth.isRoot() && ni->d_qtype == qtnull) {
if (!refresh && (serveStale || ni->d_servedStale > 0) && ni->d_ttd <= now.tv_sec && ni->d_servedStale < s_maxServedStaleExtensions) {
- updateStaleEntry(now.tv_sec, ni, QType(QType::A));
+ updateStaleEntry(now.tv_sec, ni, QType::A);
}
// We have something
if (now.tv_sec < ni->d_ttd) {
return false;
}
-void NegCache::updateStaleEntry(time_t now, negcache_t::iterator& entry, const QType& qtype)
+void NegCache::updateStaleEntry(time_t now, negcache_t::iterator& entry, QType qtype)
{
// We need to take care a infrequently access stale item cannot be extended past
// s_maxServedStaleExtension * s_serveStaleExtensionPeriod
entry->d_servedStale = std::min(entry->d_servedStale + 1 + howlong / extension, static_cast<time_t>(s_maxServedStaleExtensions));
entry->d_ttd = now + std::min(entry->d_orig_ttl, s_serveStaleExtensionPeriod);
- pushAlmostExpiredTask(entry->d_name, entry->d_qtype == 0 ? qtype : entry->d_qtype, entry->d_ttd, Netmask());
+ if (qtype == QType::ENT) {
+ qtype = QType::A;
+ }
+
+ pushAlmostExpiredTask(entry->d_name, qtype, entry->d_ttd, Netmask());
}
/*!
* \param ne A NegCacheEntry that is filled when there is a cache entry
* \return true if ne was filled out, false otherwise
*/
-bool NegCache::get(const DNSName& qname, const QType& qtype, const struct timeval& now, NegCacheEntry& ne, bool typeMustMatch, bool serveStale, bool refresh)
+bool NegCache::get(const DNSName& qname, QType qtype, const struct timeval& now, NegCacheEntry& ne, bool typeMustMatch, bool serveStale, bool refresh)
{
auto& map = getMap(qname);
auto content = map.lock();
while (ni != range.second) {
// We have an entry
- if ((!typeMustMatch && ni->d_qtype.getCode() == 0) || ni->d_qtype == qtype) {
+ if ((!typeMustMatch && ni->d_qtype == QType::ENT) || ni->d_qtype == qtype) {
// We match the QType or the whole name is denied
auto firstIndexIterator = content->d_map.project<CompositeKey>(ni);
* \param qtype The type of the entry to replace
* \param newState The new validation state
*/
-void NegCache::updateValidationStatus(const DNSName& qname, const QType& qtype, const vState newState, boost::optional<time_t> capTTD)
+void NegCache::updateValidationStatus(const DNSName& qname, const QType qtype, const vState newState, boost::optional<time_t> capTTD)
{
auto& mc = getMap(qname);
auto map = mc.lock();
};
void add(const NegCacheEntry& ne);
- void updateValidationStatus(const DNSName& qname, const QType& qtype, const vState newState, boost::optional<time_t> capTTD);
- bool get(const DNSName& qname, const QType& qtype, const struct timeval& now, NegCacheEntry& ne, bool typeMustMatch = false, bool serverStale = false, bool refresh = false);
+ void updateValidationStatus(const DNSName& qname, QType qtype, vState newState, boost::optional<time_t> capTTD);
+ bool get(const DNSName& qname, QType qtype, const struct timeval& now, NegCacheEntry& ne, bool typeMustMatch = false, bool serverStale = false, bool refresh = false);
bool getRootNXTrust(const DNSName& qname, const struct timeval& now, NegCacheEntry& ne, bool serveStale, bool refresh);
size_t count(const DNSName& qname);
- size_t count(const DNSName& qname, const QType qtype);
+ size_t count(const DNSName& qname, QType qtype);
void prune(size_t maxEntries);
void clear();
size_t doDump(int fd, size_t maxCacheEntries);
member<NegCacheEntry, DNSName, &NegCacheEntry::d_name>>>>
negcache_t;
- void updateStaleEntry(time_t now, negcache_t::iterator& entry, const QType& qtype);
+ void updateStaleEntry(time_t now, negcache_t::iterator& entry, QType qtype);
struct MapCombo
{