time_t current_time = time(NULL);
// Try to get the lastupdated time of the actual service if there is one.
- if ( !service->get_last_updates().empty() )
- lastupdated = service->get_last_updates().front(); /*lint !e1793 */
+ // And check for burnt IP, too.
+ std::map<time_t,std::string> last_updates = service->get_last_updates(); /*lint !e1793 */
+ if ( last_updates.size() > 0 )
+ {
+ bool ip_burnt = true;
+ string ip_next_to_last_update;
+ int max_equal_updates_in_succession = service->get_max_equal_updates_in_succession();
+ int i = 0;
+ for ( std::map<time_t,std::string>::reverse_iterator r_iter; (r_iter != last_updates.rend()) && (i < max_equal_updates_in_succession); r_iter++ )
+ {
+ if ( i == 0 )
+ lastupdated = r_iter->first;
+
+ if ( ip_host != r_iter->second )
+ {
+ ip_burnt = false;
+ break;
+ }
+
+ i++;
+ }
+
+ Log->print_last_updates(ip_host,max_equal_updates_in_succession,last_updates,service->get_hostname());
+
+ if ( ip_burnt )
+ {
+ // IP Address is burnt. Too many updates in succession with the same IP.
+ Log->print_ip_burnt(ip_host,service->get_hostname());
+ continue;
+ }
+ }
Log->print_check_service_update(hostname, current_time, lastupdated);