<< " removes CNAME to " << get_cname(hostname).Host << "!";
update(hostname, Cname()); // overwrite with "empty" cname
}
- GlobalLogger.debug() << "DnsCache: update IPs for " << key
+ GlobalLogger.info() << "DnsCache: update IPs for " << key
<< " to " << new_ips.size() << "-list";
IpCache[key] = new_ips;
HasChanged = true;
}
result = result_up_to_date;
}
- GlobalLogger.debug() << "DnsCache: request IPs for " << key
+ /*GlobalLogger.debug() << "DnsCache: request IPs for " << key
<< " --> " << result.size() << "-list";
BOOST_FOREACH( const HostAddress &addr, result )
GlobalLogger.debug() << "DnsCache: " << addr.get_ip().to_string()
<< " (TTL " << addr.get_ttl().get_updated_value()
- << "s)";
+ << "s)"; */
return result;
}
{
std::string key = key_for_hostname(hostname);
Cname result_obj = CnameCache[key];
- GlobalLogger.debug() << "DnsCache: request CNAME for " << key
+ /*GlobalLogger.debug() << "DnsCache: request CNAME for " << key
<< " --> \"" << result_obj.Host << "\" (TTL "
- << result_obj.Ttl.get_updated_value() << "s)";
+ << result_obj.Ttl.get_updated_value() << "s)";*/
if (result_obj.Host.empty())
return result_obj;
{
if (addr.get_ttl().get_updated_value() > min_cname_ttl)
{
- GlobalLogger.debug() << "DnsCache: using shorter CNAME TTL";
+ //GlobalLogger.debug() << "DnsCache: using shorter CNAME TTL";
addr.set_ttl(cname_ttl);
}
}
&result_name_servers);
// results should have the logical order
// Hostname [ --> cname1 --> cname2 --> ... --> cnameN ] [ --> ips ]
+ // for cname count to be correct; rest of code should not be affected if not
// remember cname list (if there were any)
BOOST_FOREACH( const src_cname_pair &host_and_cname, result_cnames )
{
if ( !WantToPing )
{
- GlobalLogger.info() << LogPrefix << "waiting for ping request";
+ GlobalLogger.info() << LogPrefix << "waiting for ping request "
+ << "(should take less than " << PingIntervalInSec << "s)";
return;
}
else if ( Resolver && Resolver->is_resolving() )
else
{
uint32_t ttl = ip.get_ttl().get_updated_value();
- boost::posix_time::ptime now =
+ std::string expiry;
+ if (ttl == 0)
+ expiry = "out of date!";
+ else
+ {
+ boost::posix_time::ptime now =
boost::posix_time::second_clock::local_time();
- std::string expiry =
- boost::posix_time::to_simple_string(now + seconds(ttl));
+ expiry = boost::posix_time::to_simple_string(now + seconds(ttl));
+ }
GlobalLogger.info() << LogPrefix << "pinging IP " << ip.get_ip()
- << " with TTL " << ttl << "s (until " << expiry << ")";
+ << " with TTL " << ttl << "s (" << expiry << ")";
Ping->ping( ip.get_ip(),
DestinationPort,
boost::bind(&PingScheduler::ping_done_handler, this, _1) );
current_protocol);
// get number of up-to-date IPs
+ // TODO should check here, if they will be up to date in PingIntervalInSec
bool check_up_to_date = true;
int ip_count = Resolver->get_resolved_ip_count(check_up_to_date);
if (ip_count > 0)
{
GlobalLogger.info() << LogPrefix << "Set resolved_ip_count to "
- << ip_count << " where IPs may be outdated: " << false;
+ << ip_count << " where IPs may be outdated: " << !check_up_to_date;
HostAnalyzer.set_resolved_ip_count( ip_count );
if (Resolver->is_resolving())
ping_when_ready();
}
else
+ {
+ GlobalLogger.info() << LogPrefix
+ << "No up-to-date IPs --> start resolve";
start_resolving_ping_address();
- // set resolved_ip_count in resolve callback
+ // set resolved_ip_count will be called in resolve callback
+ }
}
void PingScheduler::start_resolving_ping_address()