// Whether to run this task in regular mode (false) or in the mode that refreshes almost expired tasks
bool d_refreshMode;
// Use a function pointer as comparing std::functions is a nuisance
- using TaskFunction = void (*)(const struct timeval& now, bool logErrors, const ResolveTask& task);
+ using TaskFunction = void (*)(const struct timeval& now, bool logErrors, const ResolveTask& task);
TaskFunction d_func;
// IP used by DoT probe tasks
ComboAddress d_ip;
struct DoTStatus
{
+ DoTStatus(const ComboAddress& ip, const DNSName& auth, time_t ttd) :
+ d_address(ip), d_auth(auth), d_ttd(ttd)
+ {
+ }
enum Status : uint8_t { Unknown, Busy, Bad, Good };
const ComboAddress d_address;
const DNSName d_auth;
time_t d_ttd;
+ mutable uint64_t d_count{0};
mutable Status d_status{Unknown};
std::string toString() const
{
return 0;
}
fprintf(fp.get(), "; DoT probing map follows");
- fprintf(fp.get(), "; ip\tstatus\tttd\n");
+ fprintf(fp.get(), "; ip\tdomain\tcount\tstatus\tttd\n");
uint64_t count=0;
// We get a copy, so the I/O does not need to happen while holding the lock
for (const auto& i : copy.d_map) {
count++;
char tmp[26];
- fprintf(fp.get(), "%s\t%s\t%s\t%s\n", i.d_address.toString().c_str(), i.d_auth.toString().c_str(), i.toString().c_str(), timestamp(i.d_ttd, tmp, sizeof(tmp)));
+ fprintf(fp.get(), "%s\t%s\t%" PRIu64 "\t%s\t%s\n", i.d_address.toString().c_str(), i.d_auth.toString().c_str(), i.d_count, i.toString().c_str(), timestamp(i.d_ttd, tmp, sizeof(tmp)));
}
return count;
}
if (it->d_status == DoTStatus::Good) {
return;
}
+ // We only want to probe auths that we have seen before, auth that only come around once are not interesting
+ if (it->d_status == DoTStatus::Unknown && it->d_count == 0) {
+ return;
+ }
}
lock->d_map.modify(it, [=] (DoTStatus& st){ st.d_ttd = now + dotFailWait; });
bool pushed = pushTryDoTTask(auth, QType::SOA, address, std::numeric_limits<time_t>::max());
auto lock = s_dotMap.lock();
auto it = lock->d_map.find(address);
if (it == lock->d_map.end()) {
- // Pruned...
return false;
}
+ it->d_count++;
if (it->d_status == DoTStatus::Good && it->d_ttd > now) {
return true;
}