From: Thomas Jarosch Date: Mon, 31 Jan 2011 10:56:13 +0000 (+0100) Subject: Cosmetic/documentation changes only X-Git-Tag: v1.1~21 X-Git-Url: http://developer.intra2net.com/git/?p=bpdyndnsd;a=commitdiff_plain;h=20f4aefd154ae46ce8af79400a3b456d30d398c7 Cosmetic/documentation changes only --- diff --git a/src/updater.cpp b/src/updater.cpp index d7bbef3..cad0ca2 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -242,12 +242,12 @@ void Updater::update_services(bool changed_to_online) const { string ip_last_update = service->get_actual_ip(); string hostname = service->get_hostname(); - time_t lastupdated = 0; time_t current_time = time(NULL); - // Try to get the lastupdated time of the actual service if there is one. + // Try to get the last update time of the service if there is one. // And check for burnt IP, too. std::map last_updates = service->get_last_updates(); /*lint !e1793 */ + time_t lastupdated = 0; int last_updates_size = last_updates.size(); int max_equal_updates_in_succession = service->get_max_equal_updates_in_succession(); @@ -259,7 +259,10 @@ void Updater::update_services(bool changed_to_online) const { bool ip_burnt = true; int i = 0; - for ( std::map::reverse_iterator r_iter = last_updates.rbegin(); (r_iter != last_updates.rend()) && (i < max_equal_updates_in_succession); r_iter++ ) + // Reverse iterate "last_updates" list so the latest update + // will be the first entry (map key is the unix timestamp) + for ( std::map::reverse_iterator r_iter = last_updates.rbegin(); + (r_iter != last_updates.rend()) && (i < max_equal_updates_in_succession); r_iter++ ) { if ( i == 0 ) lastupdated = r_iter->first;