From 4871fb1f27887f7957fab11ca13bb154c48202fe Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 18 Oct 2013 14:11:00 +0000 Subject: [PATCH] -use configuration option for reset of zone_publish_time_window, also frequency should be often enough to put every record 4x within its expiration window --- src/gns/gnunet-service-gns.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index cc2bf3fdf..61287c079 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -168,7 +168,13 @@ static struct GNUNET_TIME_Relative min_relative_record_time; static struct GNUNET_TIME_Relative put_interval; /** - * Time window for zone iteration + * Default time window for zone iteration + */ +static struct GNUNET_TIME_Relative zone_publish_time_window_default; + +/** + * Time window for zone iteration, adjusted based on relative record + * expiration times in our zone. */ static struct GNUNET_TIME_Relative zone_publish_time_window; @@ -369,8 +375,9 @@ put_gns_record (void *cls, else { zone_publish_time_window - = GNUNET_TIME_relative_min (min_relative_record_time, - DEFAULT_ZONE_PUBLISH_TIME_WINDOW); + = GNUNET_TIME_relative_min (GNUNET_TIME_relative_divide (min_relative_record_time, + 4), + zone_publish_time_window_default); put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, num_public_records); } @@ -449,6 +456,9 @@ put_gns_record (void *cls, GNUNET_GNSRECORD_query_from_private_key (key, name, &query); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Storing record in DHT with expiration `%s'\n", + GNUNET_STRINGS_absolute_time_to_string (expire)); active_put = GNUNET_DHT_put (dht_handle, &query, DHT_GNS_REPLICATION_LEVEL, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, @@ -684,17 +694,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, } put_interval = INITIAL_PUT_INTERVAL; - zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; - + zone_publish_time_window_default = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (c, "gns", "ZONE_PUBLISH_TIME_WINDOW", - &zone_publish_time_window)) + &zone_publish_time_window_default)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Time window for zone iteration: %s\n", - GNUNET_STRINGS_relative_time_to_string (zone_publish_time_window, GNUNET_YES)); + GNUNET_STRINGS_relative_time_to_string (zone_publish_time_window, + GNUNET_YES)); } + zone_publish_time_window = zone_publish_time_window_default; if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (c, "gns", "MAX_PARALLEL_BACKGROUND_QUERIES", -- 2.25.1