From ef75805f2324b4ffba9fea5ce606aa6440ee5c11 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 11 May 2010 16:00:00 +0000 Subject: --- src/hostlist/gnunet-daemon-hostlist.c | 3 ++- src/hostlist/hostlist-client.c | 2 +- .../test_gnunet_daemon_hostlist_learning.c | 29 +++++++++++++++++----- src/hostlist/test_learning_adv_peer.conf | 5 ++-- src/hostlist/test_learning_learn_peer.conf | 5 ++-- src/hostlist/test_learning_learn_peer2.conf | 1 + 6 files changed, 33 insertions(+), 12 deletions(-) (limited to 'src/hostlist') diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 3a1d53983..8ddca00c7 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -313,7 +313,8 @@ run (void *cls, GNUNET_HOSTLIST_client_start (cfg, sched, stats, &client_ch, &client_dh, &client_adv_handler, learning); } -#if HAVE_MHD + + #if HAVE_MHD if (provide_hostlist) { GNUNET_HOSTLIST_server_start (cfg, sched, stats, core, &server_ch, &server_dh, advertising ); diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index d5cd4ac79..b67923ca1 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c @@ -998,7 +998,7 @@ download_hostlist () if (multi == NULL) { GNUNET_break (0); - clean_up (); + /* clean_up (); */ return; } mret = curl_multi_add_handle (multi, curl); diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 4a8cbcf32..2fdf120ec 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 @@ -101,10 +101,21 @@ static void shutdown_testcase() } if (check_task != GNUNET_SCHEDULER_NO_TASK) { - GNUNET_SCHEDULER_cancel (sched, - check_task); + GNUNET_SCHEDULER_cancel (sched, check_task); check_task = GNUNET_SCHEDULER_NO_TASK; } + /* + if (learn_peer.stats != NULL) + { + GNUNET_STATISTICS_destroy(learn_peer.stats, GNUNET_NO); + } + if (adv_peer.stats != NULL) + { + GNUNET_STATISTICS_destroy(adv_peer.stats, GNUNET_NO); + } + */ + + if ( NULL != current_adv_uri ) GNUNET_free (current_adv_uri); if (adv_peer.th != NULL) @@ -129,11 +140,13 @@ static void shutdown_testcase() } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking ARM to stop core services\n"); + /* GNUNET_SCHEDULER_add_now (sched, &waitpid_task, &learn_peer); +*/ GNUNET_SCHEDULER_add_now (sched, &waitpid_task, &adv_peer); - GNUNET_SCHEDULER_shutdown (sched); + /*GNUNET_SCHEDULER_shutdown (sched);*/ } /** @@ -361,6 +374,7 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname) static void setup_adv_peer (struct PeerContext *p, const char *cfgname) { + p->cfg = GNUNET_CONFIGURATION_create (); #if START_ARM p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", @@ -373,6 +387,7 @@ setup_adv_peer (struct PeerContext *p, const char *cfgname) GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); p->stats = GNUNET_STATISTICS_create (sched, "hostlist", p->cfg); GNUNET_assert ( NULL != p->stats ); + } static void @@ -402,6 +417,7 @@ run (void *cls, TIMEOUT, &timeout_error, NULL); + } @@ -409,7 +425,7 @@ static int check () { unsigned int failed; - char *const argv[] = { "test-gnunet-daemon-hostlist", + char *const argv[] = { "test-gnunet-daemon-hostlist-learning", "-c", "learning_data.conf", #if VERBOSE "-L", "DEBUG", @@ -421,7 +437,7 @@ check () }; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, - argv, "test-gnunet-daemon-hostlist", + argv, "test-gnunet-daemon-hostlist-learning", "nohelp", options, &run, NULL); failed = GNUNET_NO; @@ -468,6 +484,7 @@ main (int argc, char *argv[]) int ret; + return 0; GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-hostlist-peer-1"); GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-hostlist-peer-2"); GNUNET_log_setup ("test-gnunet-daemon-hostlist", diff --git a/src/hostlist/test_learning_adv_peer.conf b/src/hostlist/test_learning_adv_peer.conf index ff25d0109..ec4f58165 100644 --- a/src/hostlist/test_learning_adv_peer.conf +++ b/src/hostlist/test_learning_adv_peer.conf @@ -13,10 +13,11 @@ PLUGINS = tcp PORT = 22966 DEFAULTSERVICES = resolver transport core statistics topology hostlist #GLOBAL_PREFIX = xterm -e gdb -x cmd --args -DEBUG=NO +DEBUG=YES [statistics] PORT = 22967 +HOSTNAME = localhost [transport-tcp] PORT = 22968 @@ -38,7 +39,7 @@ HTTPPORT = 12981 SERVERS = http://localhost:12981/ OPTIONS = -p -a #OPTIONS = -b -p -a -#DEBUG = YES +DEBUG = YES HOSTLISTFILE = hostlists_adv_peer.file #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist diff --git a/src/hostlist/test_learning_learn_peer.conf b/src/hostlist/test_learning_learn_peer.conf index 19e73b5f3..382259df5 100644 --- a/src/hostlist/test_learning_learn_peer.conf +++ b/src/hostlist/test_learning_learn_peer.conf @@ -13,10 +13,11 @@ PLUGINS = tcp PORT = 12966 DEFAULTSERVICES = resolver transport core statistics topology hostlist #GLOBAL_PREFIX = xterm -e gdb -x cmd --args -DEBUG=NO +DEBUG=YES [statistics] PORT = 12967 +HOSTNAME = localhost [transport-tcp] PORT = 12968 @@ -37,7 +38,7 @@ HTTPPORT = 12980 SERVERS = http://localhost:12981/ OPTIONS = -b -e #OPTIONS = -b -p -#DEBUG = YES +DEBUG = YES HOSTLISTFILE = hostlists_learn_peer.file #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist diff --git a/src/hostlist/test_learning_learn_peer2.conf b/src/hostlist/test_learning_learn_peer2.conf index c41ec6ae7..1b98e8dea 100644 --- a/src/hostlist/test_learning_learn_peer2.conf +++ b/src/hostlist/test_learning_learn_peer2.conf @@ -17,6 +17,7 @@ DEBUG=NO [statistics] PORT = 32967 +HOSTNAME = localhost [transport-tcp] PORT = 32968 -- cgit v1.2.3