* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <algorithm>
#include "rec-zonetocache.hh"
#include "syncres.hh"
// By default and max once per 24 hours
time_t refresh = 24 * 3600;
- struct timeval now;
- gettimeofday(&now, nullptr);
- SyncRes sr(now);
- bool dnssec = g_dnssecmode != DNSSECMode::Off;
- sr.setDoDNSSEC(dnssec);
- sr.setDNSSECValidationRequested(g_dnssecmode != DNSSECMode::Off && g_dnssecmode != DNSSECMode::ProcessNoValidate);
-
for (const auto& config : cfgs) {
const string msg = "zones-to-cache error while loading " + config.d_zone + ": ";
try {
- refresh = min(refresh, ZoneToCache(config, dnssec));
+ refresh = std::min(refresh, ZoneToCache(config));
}
catch (const PDNSException& e) {
g_log << Logger::Error << msg << e.reason << endl;
}
// We do not want to refresh more than once per hour
- refresh = std::max(refresh, 3600LL);
+ refresh = std::max(refresh, static_cast<time_t>(3600));
}
return refresh;
{
const auto key = make_pair(dr.d_name, dr.d_type);
- d_refresh = min(d_refresh, static_cast<time_t>(dr.d_ttl));
+ d_refresh = std::min(d_refresh, static_cast<time_t>(dr.d_ttl));
dr.d_ttl += d_now;
switch (dr.d_type) {
return lines;
}
-time_t RecZoneToCache::ZoneToCache(const Config& config, bool dnssec)
+time_t RecZoneToCache::ZoneToCache(const Config& config)
{
if (config.d_sources.size() > 1) {
// XXX Warning
std::string d_zone; // Zone name
std::string d_method; // axfr, http, https, file
vector<std::string> d_sources; // IPs or URLs
- uint32_t d_timeout{20}; // timeout in seconds
ComboAddress d_local; // local address
- size_t d_maxReceivedBytes{0}; // Maximum size
TSIGTriplet d_tt; // Authentication data
+ size_t d_maxReceivedBytes{0}; // Maximum size
+ uint32_t d_timeout{20}; // timeout in seconds
};
static time_t ZonesToCache(const std::vector<Config>&);
private:
- static time_t ZoneToCache(const Config& config, bool dnssec);
+ static time_t ZoneToCache(const Config& config);
};