From: Matthias Wachs Date: Fri, 23 Apr 2010 08:46:51 +0000 (+0000) Subject: (no commit message) X-Git-Tag: initial-import-from-subversion-38251~22025 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=067436522b13b5f638059fc9c591acc7b510d6da;p=oweals%2Fgnunet.git --- diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index da4c29d71..2f66df95d 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c @@ -418,6 +418,7 @@ get_list_url () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing new advertised hostlist if it is obtainable\n"); + current_hostlist = hostlist_to_test; return strdup(hostlist_to_test->hostlist_uri); } @@ -578,13 +579,15 @@ insert_hostlist ( void ) return; } + /** * Method updating hostlist statistics */ static void update_hostlist ( ) { char *stat; - if ( (use_preconfigured_list == GNUNET_NO) && ( NULL != current_hostlist ) ) + if ( ((use_preconfigured_list == GNUNET_NO) && ( NULL != current_hostlist )) || + ((testing_hostlist == GNUNET_YES) && ( NULL != current_hostlist )) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Updating hostlist statics for URI `%s'\n",current_hostlist->hostlist_uri ); @@ -598,6 +601,8 @@ static void update_hostlist ( ) GNUNET_asprintf (&stat, gettext_noop("# advertised URI `%s' downloaded"), current_hostlist->hostlist_uri); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Updating downloaded statics for URI to value\n" ); GNUNET_STATISTICS_update ( stats, stat, @@ -611,6 +616,9 @@ static void update_hostlist ( ) current_hostlist = NULL; /* Alternating the usage of preconfigured and learned hostlists */ + if (testing_hostlist == GNUNET_YES) + return; + if ( GNUNET_YES == learning) { if (use_preconfigured_list == GNUNET_YES) @@ -819,14 +827,15 @@ multi_ready (void *cls, _("Download of hostlist `%s' completed.\n"), current_url); download_successful = GNUNET_YES; + update_hostlist(); if (GNUNET_YES == testing_hostlist) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Adding successfully tested hostlist `%s' datastore.\n"),current_url); insert_hostlist(); + hostlist_to_test = NULL; testing_hostlist = GNUNET_NO; } - update_hostlist(); } clean_up (); return; diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index a416462d1..a2fd126b7 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -30,7 +30,7 @@ #include "gnunet_resolver_service.h" #include "gnunet_statistics_service.h" -#define VERBOSE GNUNET_NO +#define VERBOSE GNUNET_YES #define START_ARM GNUNET_YES #define MAX_URL_LEN 1000 @@ -38,7 +38,7 @@ /** * How long until wait until testcases fails */ -#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20) +#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) #define CHECK_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) static int timeout; @@ -179,7 +179,7 @@ process_downloads (void *cls, uint64_t value, int is_persistent) { - if ( (value == 1) && (learned_hostlist_downloaded == GNUNET_NO) ) + if ( (value == 2) && (learned_hostlist_downloaded == GNUNET_NO) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Client has successfully downloaded advertised URI \n"));