(no commit message)
authorMatthias Wachs <wachs@net.in.tum.de>
Fri, 23 Apr 2010 08:46:51 +0000 (08:46 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Fri, 23 Apr 2010 08:46:51 +0000 (08:46 +0000)
src/hostlist/hostlist-client.c
src/hostlist/test_gnunet_daemon_hostlist_learning.c

index da4c29d710e0e7a673ec1df37aff135a5f269aec..2f66df95d6d89d264bbc9d53ea19c242f73a4ae2 100644 (file)
@@ -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;
index a416462d174555e57683a31f89e0c067090cc95f..a2fd126b7a869feaddc7db42a50c17c7a4193bda 100644 (file)
@@ -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"));