Cosmetic/documentation changes only
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 31 Jan 2011 10:56:13 +0000 (11:56 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 31 Jan 2011 10:56:13 +0000 (11:56 +0100)
src/updater.cpp

index d7bbef3..cad0ca2 100644 (file)
@@ -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<time_t,std::string> 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<time_t,std::string>::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<time_t,std::string>::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;