Don't update the same IP more than 2 times in success.
[bpdyndnsd] / src / serviceholder.cpp
index 1eee942..c1c02e7 100644 (file)
@@ -68,7 +68,7 @@ int Serviceholder::serialize_services() const
     BOOST_FOREACH(const Service::Ptr &service, OldServices)
     {
         if ( !service->get_last_updates().empty() &&
-             ( service->get_last_updates().front() + ((time_t)service->get_update_interval()*60) ) >= current_time )  /*lint !e1793 */ // UpdateInterval timeout of service isn't expired.
+             ( service->get_last_update_time() + ((time_t)service->get_update_interval()*60) ) >= current_time )  /*lint !e1793 */ // UpdateInterval timeout of service isn't expired.
             service_container->add_service(service);
     }
 
@@ -149,14 +149,14 @@ int Serviceholder::deserialize_services()
         BOOST_FOREACH(Service::Ptr &old_service, _old_services)
         {
             OldServices.push_back(old_service);
-            Log->print_service_object("Deserialized following Service object:", old_service->get_protocol(), old_service->get_hostname(), old_service->get_login() ,old_service->get_password(), old_service->get_update_interval(), old_service->get_max_updates_within_interval(), old_service->get_dns_cache_ttl() , old_service->get_actual_ip(), old_service->get_last_updates());
+            Log->print_service_object("Deserialized following Service object:", old_service->get_protocol(), old_service->get_hostname(), old_service->get_login() ,old_service->get_password(), old_service->get_update_interval(), old_service->get_max_updates_within_interval(), old_service->get_max_equal_updates_in_succession(), old_service->get_dns_cache_ttl() , old_service->get_actual_ip(), old_service->get_last_updates());
             BOOST_FOREACH(Service::Ptr &service, Services)
             {
                 if ( *service == *old_service )
                 {
                     service->set_last_updates(old_service->get_last_updates());
                     service->set_actual_ip(old_service->get_actual_ip());
-                    Log->print_service_object("New Service object with adopted values:", service->get_protocol(), service->get_hostname(), service->get_login() ,service->get_password(), service->get_update_interval(), service->get_max_updates_within_interval(), service->get_dns_cache_ttl() , service->get_actual_ip(), service->get_last_updates());
+                    Log->print_service_object("New Service object with adopted values:", service->get_protocol(), service->get_hostname(), service->get_login() ,service->get_password(), service->get_update_interval(), service->get_max_updates_within_interval(), service->get_max_equal_updates_in_succession(), service->get_dns_cache_ttl() , service->get_actual_ip(), service->get_last_updates());
                     // We have adopted the values of the old_service. Just set lastupdated and timeout to 0, so this old_service wont be serialized.
                     old_service->set_update_interval(0);
                 }