From ae0e404fbb6be75817f15a078611d4cba64e7de8 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Wed, 20 Oct 2010 14:14:26 +0200 Subject: [PATCH] Add DNS TTL/server error threshold so we don't update with the same IP too often --- src/updater.cpp | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/updater.cpp b/src/updater.cpp index 84247d5..f204b4f 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -19,6 +19,11 @@ using namespace std; +/// Server error threshold: When the host IP is not current, the DNS TTL expired +/// and we already sent an update. +const int ServerErrorTTLExpiredThreshold = 15 * 60; + + /** * Default constructor which initializes the member Conf. */ @@ -276,6 +281,12 @@ void Updater::update_services(bool changed_to_online) const else { int dns_cache_ttl = service->get_dns_cache_ttl(); + + // Add server error threshold so we don't jam the server with updates for the same IP + // in case the server doesn't hand out the already sent IP via DNS + // (might indicate a server error). + dns_cache_ttl += ServerErrorTTLExpiredThreshold; + // Check if DNS Cache TTL is expired, if so, then update the same IP again. if ( (lastupdated + dns_cache_ttl) < current_time ) { -- 1.7.1