From d4b208928497e792535cc9187d8a11866e2b3a48 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 1 Apr 2015 10:31:22 +0200 Subject: [PATCH] renamed expired_resolved_ip to have_up_to_date_ip because that makes clearer what it is used for --- src/dns/dnsresolver.cpp | 10 +++++----- src/dns/dnsresolver.h | 2 +- src/host/pingrotate.cpp | 4 ++-- src/host/pingrotate.h | 2 +- src/host/pingscheduler.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dns/dnsresolver.cpp b/src/dns/dnsresolver.cpp index f081741..6a498b1 100644 --- a/src/dns/dnsresolver.cpp +++ b/src/dns/dnsresolver.cpp @@ -162,17 +162,17 @@ string DnsResolver::get_next_ip() } /** - * @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; } diff --git a/src/dns/dnsresolver.h b/src/dns/dnsresolver.h index 5cb603a..0000384 100644 --- a/src/dns/dnsresolver.h +++ b/src/dns/dnsresolver.h @@ -49,7 +49,7 @@ public: 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(); diff --git a/src/host/pingrotate.cpp b/src/host/pingrotate.cpp index 64b0587..5f41ba0 100644 --- a/src/host/pingrotate.cpp +++ b/src/host/pingrotate.cpp @@ -128,9 +128,9 @@ int PingRotate::get_resolved_ip_count() const 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 ping_done_callback ) diff --git a/src/host/pingrotate.h b/src/host/pingrotate.h index f755f94..db298b0 100644 --- a/src/host/pingrotate.h +++ b/src/host/pingrotate.h @@ -66,7 +66,7 @@ public: bool resolve_ping_address(); int get_resolved_ip_count() const; - bool expired_resolved_ip() const; + bool have_up_to_date_ip() const; private: // diff --git a/src/host/pingscheduler.cpp b/src/host/pingscheduler.cpp index dbde917..a4042ff 100644 --- a/src/host/pingscheduler.cpp +++ b/src/host/pingscheduler.cpp @@ -164,7 +164,7 @@ void PingScheduler::resolve_and_ping(const boost::system::error_code &error) 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 ) -- 1.7.1