From: Thomas Jarosch Date: Wed, 6 Oct 2010 13:00:19 +0000 (+0200) Subject: Save one more indent/if level X-Git-Tag: v1.1~88 X-Git-Url: http://developer.intra2net.com/git/?p=bpdyndnsd;a=commitdiff_plain;h=de2abebdc1e248a2e6b647b325cb4c54f4776b33 Save one more indent/if level --- diff --git a/src/updater.cpp b/src/updater.cpp index cbd93a9..be6d29a 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -255,6 +255,7 @@ void Updater::update_services() const if (ip_host == ip_dns_recheck ) { Log->print_no_update_needed(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated); + // No update needed continue; } @@ -264,31 +265,32 @@ void Updater::update_services() const // Update for the firt time. Log->print_update_service_firttime(hostname, ip_dns_recheck, ip_host); service->update(ip_host,current_time); + + // Update done, go to next service + continue; + } + + // We already have updated, check if the IP set in last update differs from the actual host's ip. + if ( ip_last_update != ip_host ) + { + // Update + Log->print_update_service(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated); + service->update(ip_host,current_time); } else { - // We already have updated, check if the IP set in last update differs from the actual host's ip. - if ( ip_last_update != ip_host ) + int dns_cache_ttl = service->get_dns_cache_ttl(); + // Check if DNS Cache TTL is expired, if so, then update the same IP again. + if ( (lastupdated + dns_cache_ttl) < current_time ) { // Update - Log->print_update_service(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated); + Log->print_update_service_ttl_expired(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated, dns_cache_ttl, current_time); service->update(ip_host,current_time); } else { - int dns_cache_ttl = service->get_dns_cache_ttl(); - // Check if DNS Cache TTL is expired, if so, then update the same IP again. - if ( (lastupdated + dns_cache_ttl) < current_time ) - { - // Update - Log->print_update_service_ttl_expired(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated, dns_cache_ttl, current_time); - service->update(ip_host,current_time); - } - else - { - // DNS cache TTL isn't expired - Log->print_update_service_ttl_not_expired(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated, dns_cache_ttl, current_time); - } + // DNS cache TTL isn't expired + Log->print_update_service_ttl_not_expired(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated, dns_cache_ttl, current_time); } } }