}
/**
- * @brief Check if the resolved IPs are still valid.
+ * @brief check if there is any IP that is still valid
*
- * @return @c true if the last IPs resolved for the host have expired, thus
- * requiring another query for up-to-date IPs.
+ * @return @c false if there is no IP whose TTL has not expired, thus
+ * requiring another query to resolve()
*/
-bool DnsResolver::expired_resolved_ip() const
+bool DnsResolver::have_up_to_date_ip() const
{
BOOST_FOREACH( const HostAddress &host_address, ResolvedHostAddressList )
{
uint32_t ttl = host_address.get_ttl().get_updated_value();
- if ( ttl <= ResolvedIpTtlThreshold )
+ if ( ttl > ResolvedIpTtlThreshold )
{
return true;
}
int get_resolved_ip_count() const;
std::string get_next_ip();
- bool expired_resolved_ip() const;
+ bool have_up_to_date_ip() const;
private:
bool handle_ip_address();
return IpList->get_resolved_ip_count();
}
-bool PingRotate::expired_resolved_ip() const
+bool PingRotate::have_up_to_date_ip() const
{
- return IpList->expired_resolved_ip();
+ return IpList->have_up_to_date_ip();
}
void PingRotate::set_ping_done_callback( function<void(bool)> ping_done_callback )
bool resolve_ping_address();
int get_resolved_ip_count() const;
- bool expired_resolved_ip() const;
+ bool have_up_to_date_ip() const;
private:
//
return;
}
- bool ips_up_to_date = EverHadAnyIP && !Ping->expired_resolved_ip();
+ bool ips_up_to_date = EverHadAnyIP && Ping->have_up_to_date_ip();
// determine if address resolution is required
if ( !ips_up_to_date )