{
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();
{
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;