From 86fe7ccb1f18a3bd9f086e0f127062a073ae8601 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 16 Apr 2010 10:29:15 +0000 Subject: [PATCH] Hostlists are now saved to disk regularly --- src/hostlist/hostlist-client.c | 28 +++++++++------------------- src/hostlist/hostlist-client.h | 2 +- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index 7370899bd..a9bddb061 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c @@ -746,13 +746,6 @@ schedule_hostlist_task () NULL); } -/** - * Compute when we should save the hostlist entries the next time; - * then schedule the task accordingly. - */ -static void -schedule_hostlist_saving_task (); - /** * Task that checks if we should try to download a hostlist. * If so, we initiate the download, otherwise we schedule @@ -768,19 +761,9 @@ hostlist_saving_task (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Scheduled saving of hostlists\n")); save_hostlist_file ( GNUNET_NO ); - /*schedule_hostlist_saving_task ();*/ -} - -/** - * Compute when we should save the hostlist entries the next time; - * then schedule the task accordingly. - */ -static void -schedule_hostlist_saving_task () -{ GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Hostlists will be saved to file again in %llums\n"), + _("Hostlists will be saved to file again in %llums\n"), (unsigned long long) SAVING_INTERVALL.value); saving_task = GNUNET_SCHEDULER_add_delayed (sched, SAVING_INTERVALL, @@ -1193,7 +1176,14 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, linked_list_head = NULL; linked_list_tail = NULL; load_hostlist_file (); - // schedule_hostlist_saving_task (); + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + _("Hostlists will be saved to file again in %llums\n"), + (unsigned long long) SAVING_INTERVALL.value); + saving_task = GNUNET_SCHEDULER_add_delayed (sched, + SAVING_INTERVALL, + &hostlist_saving_task, + NULL); GNUNET_STATISTICS_get (stats, "hostlist", diff --git a/src/hostlist/hostlist-client.h b/src/hostlist/hostlist-client.h index a147e25cd..1e1237a82 100644 --- a/src/hostlist/hostlist-client.h +++ b/src/hostlist/hostlist-client.h @@ -33,7 +33,7 @@ #include "gnunet_time_lib.h" #define MAX_NUMBER_HOSTLISTS 30 -#define SAVING_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) +#define SAVING_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) /* * Defines concerning the hostlist quality metric -- 2.25.1