renamed expired_resolved_ip to have_up_to_date_ip because that makes clearer what...
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 1 Apr 2015 08:31:22 +0000 (10:31 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 4 May 2015 14:57:57 +0000 (16:57 +0200)
src/dns/dnsresolver.cpp
src/dns/dnsresolver.h
src/host/pingrotate.cpp
src/host/pingrotate.h
src/host/pingscheduler.cpp

index f081741..6a498b1 100644 (file)
@@ -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;
         }
index 5cb603a..0000384 100644 (file)
@@ -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();
index 64b0587..5f41ba0 100644 (file)
@@ -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<void(bool)> ping_done_callback )
index f755f94..db298b0 100644 (file)
@@ -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:
     //
index dbde917..a4042ff 100644 (file)
@@ -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 )